# HG changeset patch # User Matti Hamalainen # Date 1688422753 -10800 # Node ID 97833753b599c83e06b772c3c803a1b15716b9de # Parent ac9895c6b056e775494ccd570723280bb3975b72 Cleanups. diff -r ac9895c6b056 -r 97833753b599 th_config.c --- a/th_config.c Sun Jul 02 14:41:50 2023 +0300 +++ b/th_config.c Tue Jul 04 01:19:13 2023 +0300 @@ -954,7 +954,7 @@ /* Find a configuration item based on section and/or name (and/or) type. * The first matching item will be returned. */ -static th_cfgitem_t *th_cfg_find_do(th_cfgitem_t *item, const char *name, const int type) +static th_cfgitem_t *th_cfg_item_find_do(th_cfgitem_t *item, const char *name, const int type) { while (item != NULL) { @@ -964,15 +964,17 @@ if (type != -1 && item->type != type) match = false; + else // Check item name - if (name != NULL && item->name != NULL && + if (name != NULL && + item->name != NULL && strcmp(name, item->name) != 0) match = false; // Recurse to section if (!match && item->type == CFG_ITEM_SECTION) { - th_cfgitem_t *tmp = th_cfg_find_do(item->v.section, name, type); + th_cfgitem_t *tmp = th_cfg_item_find_do(item->v.section, name, type); if (tmp != NULL) return tmp; } @@ -993,9 +995,9 @@ th_cfgitem_t *node; if (section != NULL) - node = th_cfg_find_do(cfg, section, CFG_ITEM_SECTION); + node = th_cfg_item_find_do(cfg, section, CFG_ITEM_SECTION); else node = cfg; - return th_cfg_find_do(node, name, type); + return th_cfg_item_find_do(node, name, type); }