From add3564d2f2804ad37b9af773ec6420b497a1725 Mon Sep 17 00:00:00 2001 From: Adrian Ratiu Date: Wed, 25 Mar 2026 21:54:52 +0200 Subject: hook: move unsorted_string_list_remove() to string-list.[ch] Move the convenience wrapper from hook to string-list since it's a more suitable place. Add a doc comment to the header. Also add a free_util arg to make the function more generic and make the API similar to other functions in string-list.h. Update the existing call-sites. Suggested-by: Patrick Steinhardt Signed-off-by: Adrian Ratiu Signed-off-by: Junio C Hamano --- string-list.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'string-list.h') diff --git a/string-list.h b/string-list.h index 3ad862a187..b86ee7c099 100644 --- a/string-list.h +++ b/string-list.h @@ -265,6 +265,14 @@ struct string_list_item *unsorted_string_list_lookup(struct string_list *list, */ void unsorted_string_list_delete_item(struct string_list *list, int i, int free_util); +/** + * Remove the first item matching `str` from an unsorted string_list. + * No-op if `str` is not found. If `free_util` is non-zero, the `util` + * pointer of the removed item is freed before deletion. + */ +void unsorted_string_list_remove(struct string_list *list, const char *str, + int free_util); + /** * Split string into substrings on characters in `delim` and append the * substrings to `list`. The input string is not modified. -- cgit v1.3