Re: [AD] get_config_string return value

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


#include <hallo.h>
Peter Wang wrote on Thu May 24, 2001 um 10:44:45AM:
> Yesterday I found that `get_config_string' returns the empty string
> for a variable if the config file contains "var =".  Is this a
> recent change, or has it always been like this?

I patched it for Debian.


--- allegro3936-3936.orig/src/config.c
+++ allegro3936-3936/src/config.c
@@ -632,10 +632,15 @@
 	       in_section = (ustricmp(section, p->name) == 0);
 	    }
 	    if ((in_section) || (ugetc(name) == '[')) {
-	       /* is this the one? */
-	       if (ustricmp(p->name, name) == 0)
-		  return p;
-	    }
+          /* is this the one? */
+          if (ustricmp(p->name, name) == 0) {
+             if ((p->data == NULL) || (ustrlen(p->data) == 0))
+                /* check, if entry exists but is undefined */
+                return NULL;
+             else
+                return p;
+          }
+       }
 	 }
 
 	 if (prev)

MfG,
Eduard.
-- 
Expect the unexpected and expect the expected to be late.



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/