string_list: add a function string_list_longest_prefix()

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>
This commit is contained in:
Michael Haggerty
2012-09-12 16:04:46 +02:00
committed by Junio C Hamano
parent 31d5451eed
commit f103f95b11
5 changed files with 86 additions and 0 deletions

View File

@ -75,6 +75,14 @@ Functions
to be deleted. Preserve the order of the items that are
retained.
`string_list_longest_prefix`::
Return the longest string within a string_list that is a
prefix (in the sense of prefixcmp()) of the specified string,
or NULL if no such prefix exists. This function does not
require the string_list to be sorted (it does a linear
search).
`print_string_list`::
Dump a string_list to stdout, useful mainly for debugging purposes. It