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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
598019769c
commit
116fb64e43
@ -528,7 +528,6 @@ int cmd_config(int argc, const char **argv, const char *prefix)
|
||||
if (!is_absolute_path(given_config_source.file) && prefix)
|
||||
given_config_source.file =
|
||||
xstrdup(prefix_filename(prefix,
|
||||
strlen(prefix),
|
||||
given_config_source.file));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user