[freenos] r397 committed - Fixed libconfig_find() such that it actually returns NULL on non-exist...

  • From: freenos@xxxxxxxxxxxxxx
  • To: freenos@xxxxxxxxxxxxx
  • Date: Mon, 18 Oct 2010 23:39:30 +0000

Revision: 397
Author: nieklinnenbank
Date: Mon Oct 18 16:33:45 2010
Log: Fixed libconfig_find() such that it actually returns NULL on non-existings keys.
Previously it returned an (incorrect) pointer to the parent value.

http://code.google.com/p/freenos/source/detail?r=397

Modified:
 /branches/scratch/lib/libconfig/libconfig.c

=======================================
--- /branches/scratch/lib/libconfig/libconfig.c Fri Oct 15 13:44:33 2010
+++ /branches/scratch/lib/libconfig/libconfig.c Mon Oct 18 16:33:45 2010
@@ -364,6 +364,11 @@
                item = item->childs[i];
                break;
            }
+           if (i == item->num_childs - 1)
+           {
+               item = NULL;
+               break;
+           }
        }
     }
     return item ? item->value : NULL;

Other related posts:

  • » [freenos] r397 committed - Fixed libconfig_find() such that it actually returns NULL on non-exist... - freenos