From 31171d9e454d71144685866cfd6476b8ac69d314 Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Sun, 28 Oct 2012 17:16:24 +0100 Subject: longest_ancestor_length(): take a string_list argument for prefixes Change longest_ancestor_length() to take the prefixes argument as a string_list rather than as a colon-separated string. This will make it easier for the caller to alter the entries before calling longest_ancestor_length(). Signed-off-by: Michael Haggerty Signed-off-by: Jeff King --- test-path-utils.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'test-path-utils.c') diff --git a/test-path-utils.c b/test-path-utils.c index 3bc20e91da..acb05600df 100644 --- a/test-path-utils.c +++ b/test-path-utils.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "string-list.h" int main(int argc, char **argv) { @@ -30,7 +31,12 @@ int main(int argc, char **argv) } if (argc == 4 && !strcmp(argv[1], "longest_ancestor_length")) { - int len = longest_ancestor_length(argv[2], argv[3]); + int len; + struct string_list ceiling_dirs = STRING_LIST_INIT_DUP; + + string_list_split(&ceiling_dirs, argv[3], PATH_SEP, -1); + len = longest_ancestor_length(argv[2], &ceiling_dirs); + string_list_clear(&ceiling_dirs, 0); printf("%d\n", len); return 0; } -- cgit v1.2.1