aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-04-15 09:40:43 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-04-15 09:40:43 -0400
commitd7e081453074ca349ca3cd26cebcc584ef2eb768 (patch)
tree08f01024236c3d61655408e09cf68a1d40e141e4
parent80653fbd49ec7d66f0b08c358898facd19a5cc9a (diff)
downloadstasis-d7e081453074ca349ca3cd26cebcc584ef2eb768.tar.gz
Stop iteration on match
-rw-r--r--src/ini.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ini.c b/src/ini.c
index 2f94b5b..2d2eb57 100644
--- a/src/ini.c
+++ b/src/ini.c
@@ -23,14 +23,17 @@ struct INISection *ini_section_search(struct INIFILE **ini, unsigned mode, char
if (mode == INI_SEARCH_EXACT) {
if (!strcmp((*ini)->section[i]->key, value)) {
result = (*ini)->section[i];
+ break;
}
} else if (mode == INI_SEARCH_BEGINS) {
if (startswith((*ini)->section[i]->key, value)) {
result = (*ini)->section[i];
+ break;
}
} else if (mode == INI_SEARCH_SUBSTR) {
if (strstr((*ini)->section[i]->key, value)) {
result = (*ini)->section[i];
+ break;
}
}
}