va_end(args);
svec_clear(svec);
- for (p = find_key_le(ds_cstr(§ion));
- *p && !strncmp(section.string, *p, section.length);
- p++) {
- const char *ss = *p + section.length;
- size_t ss_len = strcspn(ss, ".=");
- svec_add_nocopy(svec, xmemdup0(ss, ss_len));
+ for (p = cfg.names; *p; p++) { /* XXX this is inefficient */
+ if (!strncmp(section.string, *p, section.length)) {
+ const char *ss = *p + section.length;
+ size_t ss_len = strcspn(ss, ".=");
+ svec_add_nocopy(svec, xmemdup0(ss, ss_len));
+ }
}
svec_unique(svec);
ds_destroy(§ion);
compare_key(const char *a, const char *b)
{
for (;;) {
- int ac = *a == '=' ? INT_MAX : *a;
- int bc = *b == '=' ? INT_MAX : *b;
+ int ac = *a == '\0' || *a == '=' ? INT_MAX : *a;
+ int bc = *b == '\0' || *b == '=' ? INT_MAX : *b;
if (ac != bc) {
return ac < bc ? -1 : 1;
} else if (ac == INT_MAX) {