summaryrefslogtreecommitdiff
path: root/test-string-list.c
AgeCommit message (Collapse)AuthorFilesLines
2012-09-15test-string-list.c: Fix some sparse warningsLibravatar Ramsay Jones1-4/+4
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()Libravatar Michael Haggerty1-0/+20
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()Libravatar Michael Haggerty1-0/+10
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()Libravatar Michael Haggerty1-0/+48
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 stringsLibravatar Michael Haggerty1-0/+45
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>