diff options
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/config.c | 1 | ||||
-rw-r--r-- | builtin/hash-object.c | 9 | ||||
-rw-r--r-- | builtin/log.c | 3 | ||||
-rw-r--r-- | builtin/mailinfo.c | 2 | ||||
-rw-r--r-- | builtin/merge-file.c | 8 | ||||
-rw-r--r-- | builtin/rev-parse.c | 4 | ||||
-rw-r--r-- | builtin/worktree.c | 2 |
7 files changed, 9 insertions, 20 deletions
diff --git a/builtin/config.c b/builtin/config.c index 05843a0f96..74f6c34d11 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -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)); } diff --git a/builtin/hash-object.c b/builtin/hash-object.c index 56df77b0c2..2ea36909d2 100644 --- a/builtin/hash-object.c +++ b/builtin/hash-object.c @@ -102,7 +102,6 @@ int cmd_hash_object(int argc, const char **argv, const char *prefix) OPT_END() }; int i; - int prefix_length = -1; const char *errstr = NULL; argc = parse_options(argc, argv, NULL, hash_object_options, @@ -113,9 +112,8 @@ int cmd_hash_object(int argc, const char **argv, const char *prefix) else prefix = setup_git_directory_gently(&nongit); - prefix_length = prefix ? strlen(prefix) : 0; if (vpath && prefix) - vpath = xstrdup(prefix_filename(prefix, prefix_length, vpath)); + vpath = xstrdup(prefix_filename(prefix, vpath)); git_config(git_default_config, NULL); @@ -146,9 +144,8 @@ int cmd_hash_object(int argc, const char **argv, const char *prefix) const char *arg = argv[i]; char *to_free = NULL; - if (0 <= prefix_length) - arg = to_free = - xstrdup(prefix_filename(prefix, prefix_length, arg)); + if (prefix) + arg = to_free = xstrdup(prefix_filename(prefix, arg)); hash_object(arg, type, no_filters ? NULL : vpath ? vpath : arg, flags, literally); free(to_free); diff --git a/builtin/log.c b/builtin/log.c index 281af8c1ec..bfdc7a23d3 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1084,8 +1084,7 @@ static const char *set_outdir(const char *prefix, const char *output_directory) if (!output_directory) return prefix; - return xstrdup(prefix_filename(prefix, outdir_offset, - output_directory)); + return xstrdup(prefix_filename(prefix, output_directory)); } static const char * const builtin_format_patch_usage[] = { diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c index e3b62f2fc7..681f07f54d 100644 --- a/builtin/mailinfo.c +++ b/builtin/mailinfo.c @@ -15,7 +15,7 @@ static char *prefix_copy(const char *prefix, const char *filename) { if (!prefix || is_absolute_path(filename)) return xstrdup(filename); - return xstrdup(prefix_filename(prefix, strlen(prefix), filename)); + return xstrdup(prefix_filename(prefix, filename)); } int cmd_mailinfo(int argc, const char **argv, const char *prefix) diff --git a/builtin/merge-file.c b/builtin/merge-file.c index 13e22a2f0b..63cd943587 100644 --- a/builtin/merge-file.c +++ b/builtin/merge-file.c @@ -28,7 +28,6 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix) xmparam_t xmp = {{0}}; int ret = 0, i = 0, to_stdout = 0; int quiet = 0; - int prefixlen = 0; struct option options[] = { OPT_BOOL('p', "stdout", &to_stdout, N_("send results to standard output")), OPT_SET_INT(0, "diff3", &xmp.style, N_("use a diff3 based merge"), XDL_MERGE_DIFF3), @@ -65,11 +64,8 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix) return error_errno("failed to redirect stderr to /dev/null"); } - if (prefix) - prefixlen = strlen(prefix); - for (i = 0; i < 3; i++) { - const char *fname = prefix_filename(prefix, prefixlen, argv[i]); + const char *fname = prefix_filename(prefix, argv[i]); if (!names[i]) names[i] = argv[i]; if (read_mmfile(mmfs + i, fname)) @@ -90,7 +86,7 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix) if (ret >= 0) { const char *filename = argv[0]; - const char *fpath = prefix_filename(prefix, prefixlen, argv[0]); + const char *fpath = prefix_filename(prefix, argv[0]); FILE *f = to_stdout ? stdout : fopen(fpath, "wb"); if (!f) 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; diff --git a/builtin/worktree.c b/builtin/worktree.c index 831fe058a5..e38325e44b 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -338,7 +338,7 @@ static int add(int ac, const char **av, const char *prefix) if (ac < 1 || ac > 2) usage_with_options(worktree_usage, options); - path = prefix_filename(prefix, strlen(prefix), av[0]); + path = prefix_filename(prefix, av[0]); branch = ac < 2 ? "HEAD" : av[1]; if (!strcmp(branch, "-")) |