summaryrefslogtreecommitdiff
path: root/quote.c
diff options
context:
space:
mode:
authorChristian Couder <chriscool@tuxfamily.org>2007-12-03 04:51:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-12-04 06:11:53 (GMT)
commitb319ce4c14f7fe0ee469a3f9def1098d84177849 (patch)
tree39a7a42798f8512ea00b49b0a4898bf898ae9cf6 /quote.c
parent41650765dea25b7804a9fdf41ce0b7db59816734 (diff)
downloadgit-b319ce4c14f7fe0ee469a3f9def1098d84177849.zip
git-b319ce4c14f7fe0ee469a3f9def1098d84177849.tar.gz
git-b319ce4c14f7fe0ee469a3f9def1098d84177849.tar.bz2
Trace and quote with argv: get rid of unneeded count argument.
Now that str_buf takes care of all the allocations, there is no more gain to pass an argument count. So this patch removes the "count" argument from: - "sq_quote_argv" - "trace_argv_printf" and all the callers. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'quote.c')
-rw-r--r--quote.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/quote.c b/quote.c
index 0455783..6986b44 100644
--- a/quote.c
+++ b/quote.c
@@ -56,20 +56,13 @@ void sq_quote_print(FILE *stream, const char *src)
fputc('\'', stream);
}
-void sq_quote_argv(struct strbuf *dst, const char** argv, int count,
- size_t maxlen)
+void sq_quote_argv(struct strbuf *dst, const char** argv, size_t maxlen)
{
int i;
- /* Count argv if needed. */
- if (count < 0) {
- for (count = 0; argv[count]; count++)
- ; /* just counting */
- }
-
/* Copy into destination buffer. */
- strbuf_grow(dst, 32 * count);
- for (i = 0; i < count; ++i) {
+ strbuf_grow(dst, 255);
+ for (i = 0; argv[i]; ++i) {
strbuf_addch(dst, ' ');
sq_quote_buf(dst, argv[i]);
if (maxlen && dst->len > maxlen)