Skip to content

Commit e35f11c

Browse files
peffgitster
authored andcommitted
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 7f51f8b (alias: use run_command api to execute aliases, 2011-01-07). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6366dd9 commit e35f11c

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

builtin/am.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ static void am_setup(struct am_state *state, enum patch_format patch_format,
10611061
}
10621062
write_state_text(state, "scissors", str);
10631063

1064-
sq_quote_argv(&sb, state->git_apply_opts.argv, 0);
1064+
sq_quote_argv(&sb, state->git_apply_opts.argv);
10651065
write_state_text(state, "apply-opt", sb.buf);
10661066

10671067
if (state->rebasing)

builtin/rev-parse.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
516516
PARSE_OPT_SHELL_EVAL);
517517

518518
strbuf_addstr(&parsed, " --");
519-
sq_quote_argv(&parsed, argv, 0);
519+
sq_quote_argv(&parsed, argv);
520520
puts(parsed.buf);
521521
return 0;
522522
}
@@ -526,7 +526,7 @@ static int cmd_sq_quote(int argc, const char **argv)
526526
struct strbuf buf = STRBUF_INIT;
527527

528528
if (argc)
529-
sq_quote_argv(&buf, argv, 0);
529+
sq_quote_argv(&buf, argv);
530530
printf("%s\n", buf.buf);
531531
strbuf_release(&buf);
532532

quote.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void sq_quotef(struct strbuf *dst, const char *fmt, ...)
5656
strbuf_release(&src);
5757
}
5858

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)
6060
{
6161
int i;
6262

@@ -65,8 +65,6 @@ void sq_quote_argv(struct strbuf *dst, const char** argv, size_t maxlen)
6565
for (i = 0; argv[i]; ++i) {
6666
strbuf_addch(dst, ' ');
6767
sq_quote_buf(dst, argv[i]);
68-
if (maxlen && dst->len > maxlen)
69-
die("Too many or long arguments");
7068
}
7169
}
7270

quote.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct strbuf;
3030
*/
3131

3232
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);
3434
extern void sq_quotef(struct strbuf *, const char *fmt, ...);
3535

3636
/* This unwraps what sq_quote() produces in place, but returns

trace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static void trace_argv_vprintf_fl(const char *file, int line,
157157

158158
strbuf_vaddf(&buf, format, ap);
159159

160-
sq_quote_argv(&buf, argv, 0);
160+
sq_quote_argv(&buf, argv);
161161
print_trace_line(&trace_default_key, &buf);
162162
}
163163

@@ -426,6 +426,6 @@ void trace_command_performance(const char **argv)
426426
atexit(print_command_performance_atexit);
427427

428428
strbuf_reset(&command_line);
429-
sq_quote_argv(&command_line, argv, 0);
429+
sq_quote_argv(&command_line, argv);
430430
command_start_time = getnanotime();
431431
}

0 commit comments

Comments
 (0)