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