diff options
author | pommicket <pommicket@gmail.com> | 2025-09-23 01:54:18 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2025-09-23 01:54:18 -0400 |
commit | dead03ddbc60151cc6405f31b1c03e12b1a28b52 (patch) | |
tree | 4f13c190c60e579206f03330af7b130b7a1b42c6 | |
parent | e36a67d03647444efbe94b5379552fbac3e5c367 (diff) |
-rw-r--r-- | pom.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -1414,13 +1414,19 @@ pom_conf_location(const pom_conf *conf, const char *key, const char **file, uint if (line) *line = item->line; return true; } else if ((i = conf_binary_search_sections(conf, key, 0, &found)), found) { - // pick an item from this section + // pick item from this section with least line number const struct conf_section *section = &conf->sections[i]; if (section->conf.items_count == 0) goto fail; - item = §ion->conf.items[0]; - if (file) *file = item->file; - if (line) *line = item->line; + uint64_t least_line = UINT64_MAX; + for (i = 0; i < section->conf.items_count; i++) { + item = §ion->conf.items[i]; + if (item->line < least_line) { + if (file) *file = item->file; + if (line) *line = item->line; + least_line = item->line; + } + } return true; } else { fail: |