(util_slist_remove): New function.
Showing
1 changed file
with
19 additions
and
0 deletions
... | @@ -741,6 +741,25 @@ util_slist_add (list_t *list, char *value) | ... | @@ -741,6 +741,25 @@ util_slist_add (list_t *list, char *value) |
741 | list_append (*list, p); | 741 | list_append (*list, p); |
742 | } | 742 | } |
743 | 743 | ||
744 | static int | ||
745 | comp (const void *item, const void *data) | ||
746 | { | ||
747 | return strcmp ((char*)item, (char*)data); | ||
748 | } | ||
749 | |||
750 | void | ||
751 | util_slist_remove (list_t *list, char *value) | ||
752 | { | ||
753 | char *p; | ||
754 | list_comparator_t cp; | ||
755 | |||
756 | if (!*list) | ||
757 | return; | ||
758 | cp = list_set_comparator (*list, comp); | ||
759 | list_remove (*list, value); | ||
760 | list_set_comparator (*list, cp); | ||
761 | } | ||
762 | |||
744 | void | 763 | void |
745 | util_slist_destroy (list_t *list) | 764 | util_slist_destroy (list_t *list) |
746 | { | 765 | { | ... | ... |
-
Please register or sign in to post a comment