diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-04-15 09:40:43 -0400 |
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-04-15 09:40:43 -0400 |
| commit | d7e081453074ca349ca3cd26cebcc584ef2eb768 (patch) | |
| tree | 08f01024236c3d61655408e09cf68a1d40e141e4 | |
| parent | 80653fbd49ec7d66f0b08c358898facd19a5cc9a (diff) | |
| download | stasis-d7e081453074ca349ca3cd26cebcc584ef2eb768.tar.gz | |
Stop iteration on match
| -rw-r--r-- | src/ini.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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; } } } |
