sq_quote_argv: drop maxlen parameter
No caller passes anything but "0" for this parameter, which requests that the function ignore it completely. In fact, in all of history there was only one such caller, and it went away in 7f51f8bc2b (alias: use run_command api to execute aliases, 2011-01-07). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Jan 15, 2018 at 17:59 UTC
e35f11c29391e557964a39204fae6b89afab6a2a
5 files changed
+7
-9
builtin/am.c
+1
-1
@@ -1061,7 +1061,7 @@ static void am_setup(struct am_state *state, enum patch_format patch_format,
1061
}
1062
write_state_text(state, "scissors", str);
1063
1064
- sq_quote_argv(&sb, state->git_apply_opts.argv, 0);
1064
+ sq_quote_argv(&sb, state->git_apply_opts.argv);
1065
write_state_text(state, "apply-opt", sb.buf);
1066
1067
if (state->rebasing)
builtin/rev-parse.c
+2
-2
@@ -516,7 +516,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
516
PARSE_OPT_SHELL_EVAL);
517
518
strbuf_addstr(&parsed, " --");
519
- sq_quote_argv(&parsed, argv, 0);
519
+ sq_quote_argv(&parsed, argv);
520
puts(parsed.buf);
521
return 0;
522
}
@@ -526,7 +526,7 @@ static int cmd_sq_quote(int argc, const char **argv)
526
struct strbuf buf = STRBUF_INIT;
527
528
if (argc)
529
- sq_quote_argv(&buf, argv, 0);
529
+ sq_quote_argv(&buf, argv);
530
printf("%s\n", buf.buf);
531
strbuf_release(&buf);
532
quote.c
+1
-3
@@ -56,7 +56,7 @@ void sq_quotef(struct strbuf *dst, const char *fmt, ...)
56
strbuf_release(&src);
57
}
58
59
-void sq_quote_argv(struct strbuf *dst, const char** argv, size_t maxlen)
59
+void sq_quote_argv(struct strbuf *dst, const char **argv)
60
{
61
int i;
62
@@ -65,8 +65,6 @@ void sq_quote_argv(struct strbuf *dst, const char** argv, size_t maxlen)
65
for (i = 0; argv[i]; ++i) {
66
strbuf_addch(dst, ' ');
67
sq_quote_buf(dst, argv[i]);
68
- if (maxlen && dst->len > maxlen)
69
- die("Too many or long arguments");
68
}
69
}
70
quote.h
+1
-1
@@ -30,7 +30,7 @@ struct strbuf;
30
*/
31
32
extern void sq_quote_buf(struct strbuf *, const char *src);
33
-extern void sq_quote_argv(struct strbuf *, const char **argv, size_t maxlen);
33
+extern void sq_quote_argv(struct strbuf *, const char **argv);
34
extern void sq_quotef(struct strbuf *, const char *fmt, ...);
35
36
/* This unwraps what sq_quote() produces in place, but returns
trace.c
+2
-2
@@ -157,7 +157,7 @@ static void trace_argv_vprintf_fl(const char *file, int line,
157
158
strbuf_vaddf(&buf, format, ap);
159
160
- sq_quote_argv(&buf, argv, 0);
160
+ sq_quote_argv(&buf, argv);
161
print_trace_line(&trace_default_key, &buf);
162
}
163
@@ -426,6 +426,6 @@ void trace_command_performance(const char **argv)
426
atexit(print_command_performance_atexit);
427
428
strbuf_reset(&command_line);
429
- sq_quote_argv(&command_line, argv, 0);
429
+ sq_quote_argv(&command_line, argv);
430
command_start_time = getnanotime();
431
}