sq_quote_argv: drop maxlen parameter
authorJeff King <peff@peff.net>
Mon, 15 Jan 2018 10:59:43 +0000 (17:59 +0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 16 Jan 2018 20:16:54 +0000 (12:16 -0800)
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>
builtin/am.c
builtin/rev-parse.c
quote.c
quote.h
trace.c
index acfe9d3c8cd6dbd8362c17d55dc036ce6682ce8a..5bdd2d75781076636f93800520e9ed161295724f 100644 (file)
@@ -1061,7 +1061,7 @@ static void am_setup(struct am_state *state, enum patch_format patch_format,
        }
        write_state_text(state, "scissors", str);
 
-       sq_quote_argv(&sb, state->git_apply_opts.argv, 0);
+       sq_quote_argv(&sb, state->git_apply_opts.argv);
        write_state_text(state, "apply-opt", sb.buf);
 
        if (state->rebasing)
index 74aa644cbb37b5741c521eba53d0a040aaf1582e..96d06a5d01d6189a647baae4f8c401d8435fff37 100644 (file)
@@ -516,7 +516,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
                        PARSE_OPT_SHELL_EVAL);
 
        strbuf_addstr(&parsed, " --");
-       sq_quote_argv(&parsed, argv, 0);
+       sq_quote_argv(&parsed, argv);
        puts(parsed.buf);
        return 0;
 }
@@ -526,7 +526,7 @@ static int cmd_sq_quote(int argc, const char **argv)
        struct strbuf buf = STRBUF_INIT;
 
        if (argc)
-               sq_quote_argv(&buf, argv, 0);
+               sq_quote_argv(&buf, argv);
        printf("%s\n", buf.buf);
        strbuf_release(&buf);
 
diff --git a/quote.c b/quote.c
index de2922ddd63d6fc001822d116387c8ced7d7630d..b2970da627af4c2b389f65db81d47f88a407223d 100644 (file)
--- a/quote.c
+++ b/quote.c
@@ -56,7 +56,7 @@ void sq_quotef(struct strbuf *dst, const char *fmt, ...)
        strbuf_release(&src);
 }
 
-void sq_quote_argv(struct strbuf *dst, const char** argv, size_t maxlen)
+void sq_quote_argv(struct strbuf *dst, const char **argv)
 {
        int i;
 
@@ -65,8 +65,6 @@ void sq_quote_argv(struct strbuf *dst, const char** argv, size_t maxlen)
        for (i = 0; argv[i]; ++i) {
                strbuf_addch(dst, ' ');
                sq_quote_buf(dst, argv[i]);
-               if (maxlen && dst->len > maxlen)
-                       die("Too many or long arguments");
        }
 }
 
diff --git a/quote.h b/quote.h
index 66f5644aa29d0da4f95e693429ad6f8c0eb8cf09..48a75a416b3b586631fc9ac861eeebb79f36ae12 100644 (file)
--- a/quote.h
+++ b/quote.h
@@ -30,7 +30,7 @@ struct strbuf;
  */
 
 extern void sq_quote_buf(struct strbuf *, const char *src);
-extern void sq_quote_argv(struct strbuf *, const char **argv, size_t maxlen);
+extern void sq_quote_argv(struct strbuf *, const char **argv);
 extern void sq_quotef(struct strbuf *, const char *fmt, ...);
 
 /* This unwraps what sq_quote() produces in place, but returns
diff --git a/trace.c b/trace.c
index b7530b51a9e4d20825d42fcfd2a5dd389ad3b44e..fa9174fc4bc44336f39ad2939b365cc4a1668a9f 100644 (file)
--- a/trace.c
+++ b/trace.c
@@ -157,7 +157,7 @@ static void trace_argv_vprintf_fl(const char *file, int line,
 
        strbuf_vaddf(&buf, format, ap);
 
-       sq_quote_argv(&buf, argv, 0);
+       sq_quote_argv(&buf, argv);
        print_trace_line(&trace_default_key, &buf);
 }
 
@@ -426,6 +426,6 @@ void trace_command_performance(const char **argv)
                atexit(print_command_performance_atexit);
 
        strbuf_reset(&command_line);
-       sq_quote_argv(&command_line, argv, 0);
+       sq_quote_argv(&command_line, argv);
        command_start_time = getnanotime();
 }