From d7e081453074ca349ca3cd26cebcc584ef2eb768 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Mon, 15 Apr 2024 09:40:43 -0400 Subject: Stop iteration on match --- src/ini.c | 3 +++ 1 file changed, 3 insertions(+) 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; } } } -- cgit