From: Christian Couder <chriscool@tuxfamily.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Helper function to shell quote all arg values at once.
Date: Mon, 21 Aug 2006 07:15:28 +0200 [thread overview]
Message-ID: <200608210715.28585.chriscool@tuxfamily.org> (raw)
In-Reply-To: <7vsljrxbg8.fsf@assigned-by-dhcp.cox.net>
Le lundi 21 août 2006 00:57, Junio C Hamano a écrit :
> Christian Couder <chriscool@tuxfamily.org> writes:
>
> > The new sq_quote_argv function is used to refactor the
> > tracing code in "git.c" and "exec_cmd.c".
> > This function allocates memory and fills it with a string
> > containing the quoted argument values. Then it returns a
> > pointer to this memory that must be freed afterwards.
>
> Sorry, I do not see a point in this.
>
> If your original were doing malloc-print-free per iteration,
> then perhaps it makes sense to first format all into one
> allocated buffer, print all, and then free at once, like this
> patch does. But that was not what the original had.
I thought that malloc-print-free was Ok, since there is already sq_quote
in quote.c that does it and is used in connect.c (except perhaps that the result from sq_quote is not freed).
> If the new function were to get a (const char **) array and
> FILE *, and print them, quoted and separated with spaces, then
> it would have shortened what two call sites did, which would
> have been an improvement. But that is not what this patch does,
> either.
The patch still shortens the 3 calls site in git.c (-8 lines) and exec_cmd.c (-5 lines).
But anyway I will rewrite it so that the new function takes (FILE*, const char **, int count) as argument.
Or perhaps I need only make this new function call sq_quote_argv ? So I only need to send another patch on top of this one ?
Thanks,
Christian.
prev parent reply other threads:[~2006-08-21 5:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-20 6:07 [PATCH] Helper function to shell quote all arg values at once Christian Couder
2006-08-20 18:32 ` Christian Couder
2006-08-20 22:57 ` Junio C Hamano
2006-08-21 5:15 ` Christian Couder [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200608210715.28585.chriscool@tuxfamily.org \
--to=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).