Skip to content
Snippets Groups Projects
Commit 76f93c4f authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Add strListFastDeleteAll()

To quickly free and remove all list entries (without realloc).
parent 4143d73f
No related branches found
No related tags found
No related merge requests found
...@@ -197,6 +197,15 @@ bool strListFastDelete(str_list_t list, size_t index, size_t count) ...@@ -197,6 +197,15 @@ bool strListFastDelete(str_list_t list, size_t index, size_t count)
return strListFastRemove(list, index, count); return strListFastRemove(list, index, count);
} }
void strListFastDeleteAll(str_list_t list)
{
size_t i;
for(i = 0; list[i] != NULL; ++i)
free(list[i]);
list[0] = NULL;
}
char* strListReplace(const str_list_t list, size_t index, const char* str) char* strListReplace(const str_list_t list, size_t index, const char* str)
{ {
char* buf; char* buf;
......
...@@ -78,6 +78,7 @@ DLLEXPORT bool strListFastRemove(str_list_t, size_t index, size_t count); ...@@ -78,6 +78,7 @@ DLLEXPORT bool strListFastRemove(str_list_t, size_t index, size_t count);
/* Remove and free a string at a specific index */ /* Remove and free a string at a specific index */
DLLEXPORT bool strListDelete(str_list_t*, size_t index); DLLEXPORT bool strListDelete(str_list_t*, size_t index);
DLLEXPORT bool strListFastDelete(str_list_t, size_t index, size_t count); DLLEXPORT bool strListFastDelete(str_list_t, size_t index, size_t count);
DLLEXPORT void strListFastDeleteAll(str_list_t);
/* Replace a string at a specific index */ /* Replace a string at a specific index */
DLLEXPORT char* strListReplace(const str_list_t, size_t index, const char* str); DLLEXPORT char* strListReplace(const str_list_t, size_t index, const char* str);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment