Commit a0fe74e4 authored by rswindell's avatar rswindell
Browse files

iniGetString() now initializes value always (unless key is not found and deflt

is NULL, still returns NULL).
parent b34cba6a
......@@ -122,11 +122,11 @@ static char* get_value(FILE* fp, const char* section, const char* key, char* val
char* iniGetString(FILE* fp, const char* section, const char* key, const char* deflt, char* value)
{
if((value=get_value(fp,section,key,value))==NULL)
return((char*)deflt);
if(*value==0) /* blank value */
return((char*)deflt);
if((value=get_value(fp,section,key,value))==NULL || *value==0 /* blank */) {
if(deflt==NULL)
return(NULL);
sprintf(value,"%.*s",INI_MAX_VALUE_LEN-1,deflt);
}
return(value);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment