changeset 779:97833753b599

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 04 Jul 2023 01:19:13 +0300
parents ac9895c6b056
children 847d1ebe5b81
files th_config.c
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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);
 }