Skip to content
Snippets Groups Projects
Commit 340d21a1 authored by rswindell's avatar rswindell
Browse files

iniGet/ReadNamedStringList() now return NULL if there are no keys in the

specified section or the section does not exist.
parent 40de6265
Branches
Tags
No related merge requests found
......@@ -998,14 +998,9 @@ iniReadNamedStringList(FILE* fp, const char* section)
char* value;
char str[INI_MAX_LINE_LEN];
ulong items=0;
named_string_t** lp;
named_string_t** lp=NULL;
named_string_t** np;
if((lp=(named_string_t**)malloc(sizeof(named_string_t*)))==NULL)
return(NULL);
*lp=NULL;
if(fp==NULL)
return(lp);
......@@ -1035,7 +1030,8 @@ iniReadNamedStringList(FILE* fp, const char* section)
items++;
}
lp[items]=NULL; /* terminate list */
if(items)
lp[items]=NULL; /* terminate list */
return(lp);
}
......@@ -1047,14 +1043,9 @@ iniGetNamedStringList(str_list_t list, const char* section)
char* value;
char str[INI_MAX_LINE_LEN];
ulong i,items=0;
named_string_t** lp;
named_string_t** lp=NULL;
named_string_t** np;
if((lp=(named_string_t**)malloc(sizeof(named_string_t*)))==NULL)
return(NULL);
*lp=NULL;
if(list==NULL)
return(lp);
......@@ -1078,7 +1069,8 @@ iniGetNamedStringList(str_list_t list, const char* section)
items++;
}
lp[items]=NULL; /* terminate list */
if(items)
lp[items]=NULL; /* terminate list */
return(lp);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment