[AD] patch for get_config_string

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


Hello,

I found a potential bug in a configuration routine. The problem was: if
a string variable is given in the configuration file, but has no
content, the pointer to the dataset with an EMPTY string is returned by
find_config_string. With this fix, the function returns NULL and
allows get_config_string to return the default value instead.

BTW: config.c is weird formated, I suggest to replace all TABs with
3-space-indentings.

Gr{us,eeting}s,
Eduard.
-- 
=====================================================================
Eduard Bloch <eb@xxxxxxxxxx>; HP: http://eduard.bloch.com/edecosi
0xEDF008C5(GnuPG): E6EB 98E2 B885 8FF0 6C04  5C1D E106 481E EDF0 08C5
**
    >> Ein Gehirn wäscht das andere.
--- /home/inet/cvs/allegro/src/config.c	Fri Dec  1 16:49:29 2000
+++ config.c	Tue Dec 26 13:33:39 2000
@@ -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 (ustrlen(p->data) == 0)
+                /* check, if entry exists but is undefined */
+                return NULL;
+             else
+                return p;
+          }
+       }
 	 }
 
 	 if (prev)

Attachment: pgpk6O_R_saN0.pgp
Description: PGP signature



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