Commit 5ee7b4e6 authored by Sebastian Ramacher's avatar Sebastian Ramacher

add girara_list_clear

parent d707bd86
......@@ -83,9 +83,9 @@ girara_list_set_free_function(girara_list_t* list, girara_free_function_t gfree)
}
void
girara_list_free(girara_list_t* list)
girara_list_clear(girara_list_t* list)
{
if (!list) {
if (list == NULL || list->start == NULL) {
return;
}
......@@ -99,6 +99,17 @@ girara_list_free(girara_list_t* list)
} else {
g_list_free(list->start);
}
list->start = NULL;
}
void
girara_list_free(girara_list_t* list)
{
if (!list) {
return;
}
girara_list_clear(list);
g_free(list);
}
......
......@@ -49,6 +49,13 @@ girara_list_t* girara_sorted_list_new2(girara_compare_function_t cmp, girara_fre
*/
void girara_list_set_free_function(girara_list_t* list, girara_free_function_t gfree);
/**
* Remove all elements from a list.
*
* @param list The girara list object
*/
void girara_list_clear(girara_list_t* list);
/**
* Destroy list.
*
......
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