From 116fb64e439d3744d0f244a51d7a6d714b7703ae Mon Sep 17 00:00:00 2001 From: Jeff King Date: Mon, 20 Mar 2017 21:22:28 -0400 Subject: prefix_filename: drop length parameter This function takes the prefix as a ptr/len pair, but in every caller the length is exactly strlen(ptr). Let's simplify the interface and just take the string. This saves callers specifying it (and in some cases handling a NULL prefix). In a handful of cases we had the length already without calling strlen, so this is technically slower. But it's not likely to matter (after all, if the prefix is non-empty we'll allocate and copy it into a buffer anyway). Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- builtin/rev-parse.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'builtin/rev-parse.c') diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index 2549643267..c8035331e2 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -228,9 +228,7 @@ static int show_file(const char *arg, int output_prefix) if ((filter & (DO_NONFLAGS|DO_NOREV)) == (DO_NONFLAGS|DO_NOREV)) { if (output_prefix) { const char *prefix = startup_info->prefix; - show(prefix_filename(prefix, - prefix ? strlen(prefix) : 0, - arg)); + show(prefix_filename(prefix, arg)); } else show(arg); return 1; -- cgit v1.2.3