Commit fc6268cf authored by rswindell's avatar rswindell
Browse files

Created strListFreeStrings().

parent 631ec626
......@@ -188,15 +188,21 @@ void strListSortAlphaCaseReverse(str_list_t list)
qsort(list,strListCount(list),sizeof(char*),strListCompareAlphaCaseReverse);
}
void strListFree(str_list_t* list)
void strListFreeStrings(str_list_t list)
{
size_t i;
if(*list!=NULL) {
for(i=0;(*list)[i]!=NULL;i++)
free((*list)[i]);
if(list!=NULL) {
for(i=0;list[i]!=NULL;i++)
free(list[i]);
list[0]=NULL; /* terminate */
}
}
void strListFree(str_list_t* list)
{
if(*list!=NULL) {
strListFreeStrings(*list);
free(*list);
}
}
......@@ -52,6 +52,9 @@ str_list_t strListInit(void);
/* Frees the strings in the list (and the list itself) */
void strListFree(str_list_t* list);
/* Frees the strings in the list */
void strListFreeStrings(str_list_t list);
/* Pass a pointer to a string list, the string to add */
/* Returns the updated list or NULL on error */
str_list_t strListAdd(str_list_t* list, const char* str);
......
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