summaryrefslogtreecommitdiff
path: root/test-string-list.c
AgeCommit message (Collapse)Author
2012-10-29string_list_longest_prefix(): remove functionMichael Haggerty
This function was added in f103f95b11d087f07c0c48bf784cd9197e18f203 in the erroneous expectation that it would be used in the reimplementation of longest_ancestor_length(). But it turned out to be easier to use a function specialized for comparing path prefixes (i.e., one that knows about slashes and root paths) than to prepare the paths in such a way that a generic string prefix comparison function can be used. So delete string_list_longest_prefix() and its documentation and test cases. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Jeff King <peff@peff.net>
2012-09-16test-string-list.c: Fix some sparse warningsRamsay Jones
In particular, sparse complains as follows: SP test-string-list.c test-string-list.c:10:6: warning: symbol 'parse_string_list' was not \ declared. Should it be static? test-string-list.c:18:6: warning: symbol 'write_list' was not \ declared. Should it be static? test-string-list.c:25:6: warning: symbol 'write_list_compact' was not \ declared. Should it be static? test-string-list.c:38:5: warning: symbol 'prefix_cb' was not \ declared. Should it be static? In order to suppress the warnings, since the above symbols do not need more than file scope, we simply include the static modifier in their declaration. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12string_list: add a function string_list_longest_prefix()Michael Haggerty
Add a function that finds the longest string from a string_list that is a prefix of a given string. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12string_list: add a new function, string_list_remove_duplicates()Michael Haggerty
Add a function that deletes duplicate entries from a sorted string_list. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12string_list: add a new function, filter_string_list()Michael Haggerty
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 <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12string_list: add two new functions for splitting stringsMichael Haggerty
Add two new functions, string_list_split() and string_list_split_in_place(). These split a string into a string_list on a separator character. The first makes copies of the substrings (leaving the input string untouched) and the second splits the original string in place, overwriting the separator characters with NULs and referring to the original string's memory. These functions are similar to the strbuf_split_*() functions except that they work with the more powerful string_list interface. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>