diff options
author | Jeff King <peff@peff.net> | 2017-03-20 21:22:28 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-21 11:12:53 -0700 |
commit | 116fb64e439d3744d0f244a51d7a6d714b7703ae (patch) | |
tree | ec3e23445081ec7fbb0bc5b711b5066ad83b42f5 /apply.c | |
parent | 598019769cbaa38495b0c04297efa13d0f4a572e (diff) | |
download | git-116fb64e439d3744d0f244a51d7a6d714b7703ae.tar.gz |
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>
Diffstat (limited to 'apply.c')
-rw-r--r-- | apply.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -2046,7 +2046,7 @@ static void prefix_one(struct apply_state *state, char **name) char *old_name = *name; if (!old_name) return; - *name = xstrdup(prefix_filename(state->prefix, state->prefix_length, *name)); + *name = xstrdup(prefix_filename(state->prefix, *name)); free(old_name); } @@ -4815,9 +4815,7 @@ int apply_all_patches(struct apply_state *state, read_stdin = 0; continue; } else if (0 < state->prefix_length) - arg = prefix_filename(state->prefix, - state->prefix_length, - arg); + arg = prefix_filename(state->prefix, arg); fd = open(arg, O_RDONLY); if (fd < 0) { |