Commit 34c80337 34c80337c72928c94ece819fbff8ba42f8580dd3 by Alain Magloire

* mailbox/list.c (list_destroy) : Call to list->destroy_item() when

        the data is free().
        (list_set_destroy_item): New function.
1 parent 787d810d
......@@ -62,6 +62,8 @@ list_destroy (list_t *plist)
{
previous = current;
current = current->next;
if (list->destroy_item)
list->destroy_item (previous->item);
free (previous);
}
monitor_unlock (list->monitor);
......@@ -293,3 +295,11 @@ list_do (list_t list, list_action_t * action, void *cbdata)
monitor_unlock (list->monitor);
return status;
}
int
list_set_destroy_item (list_t list, void (*destroy_item)(void *item))
{
if (list == NULL)
return EINVAL;
list->destroy_item = destroy_item;
}
......