From eb5f0c7a616531a024a582b72ca6d8775ff98d46 Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Wed, 12 Sep 2012 16:04:44 +0200 Subject: string_list: add a new function, filter_string_list() This function allows entries that don't match a specified criterion to be discarded from a string_list while preserving the order of the remaining entries. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- Documentation/technical/api-string-list.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Documentation') diff --git a/Documentation/technical/api-string-list.txt b/Documentation/technical/api-string-list.txt index 1dcad47f7c..300b301093 100644 --- a/Documentation/technical/api-string-list.txt +++ b/Documentation/technical/api-string-list.txt @@ -33,6 +33,9 @@ member (you need this if you add things later) and you should set the . Can remove individual items of an unsorted list using `unsorted_string_list_delete_item`. +. Can remove items not matching a criterion from a sorted or unsorted + list using `filter_string_list`. + . Finally it should free the list using `string_list_clear`. Example: @@ -61,6 +64,14 @@ Functions * General ones (works with sorted and unsorted lists as well) +`filter_string_list`:: + + Apply a function to each item in a list, retaining only the + items for which the function returns true. If free_util is + true, call free() on the util members of any items that have + to be deleted. Preserve the order of the items that are + retained. + `print_string_list`:: Dump a string_list to stdout, useful mainly for debugging purposes. It -- cgit v1.2.3