/* XXX This file really needs a unit test! For a while, cfg_get_string(0,
* "bridge.a.controller") would return the value of
* "bridge.a.controller.in-band", if it existed, and I'm really not certain
- * that the fix didn't break other things (e.g. cfg_has_section()). */
+ * that the fix didn't break other things. */
/* List of configuration files. */
static struct svec cfg_files = SVEC_EMPTY_INITIALIZER;
cfg_has_section(const char *section_, ...)
{
struct ds section;
- bool retval;
+ bool retval = false;
va_list args;
char **p;
ds_put_char(§ion, '.');
va_end(args);
- p = find_key_le(ds_cstr(§ion));
- retval = *p && !strncmp(section.string, *p, section.length);
+ for (p = cfg.names; *p; p++) { /* XXX this is inefficient */
+ if (!strncmp(section.string, *p, section.length)) {
+ retval = true;
+ break;
+ }
+ }
ds_destroy(§ion);
return retval;