Skip to content
Snippets Groups Projects
Commit 19a0797d authored by rswindell's avatar rswindell
Browse files

strListInsert() will now initialize the string list if it's uninitialized (NULL).

strListCombine() will now return an empty string rather than NULL if passed an
uninitialized string list (NULL).
parent b0ae4d42
No related branches found
No related tags found
No related merge requests found
......@@ -118,6 +118,8 @@ static char* str_list_insert(str_list_t* list, char* str, size_t index)
size_t count;
str_list_t lp;
if(*list == NULL)
*list = strListInit();
count = strListCount(*list);
if(index > count) /* invalid index, do nothing */
return(NULL);
......@@ -338,9 +340,13 @@ char* DLLCALL strListCombine(str_list_t list, char* buf, size_t maxlen, const ch
char* end;
char* ptr;
if(list==NULL || maxlen<1)
if(maxlen<1)
return(NULL);
memset(buf, 0, maxlen);
if(list==NULL)
return buf;
if(buf==NULL)
if((buf=(char*)malloc(maxlen))==NULL)
return(NULL);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment