git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Helper function to shell quote all arg values at once.

From
Christian Couder <chriscool@tuxfamily.org>
Date
Aug 21, 2006, 05:15 UTC
Message-ID
<200608210715.28585.chriscool@tuxfamily.org>
In-Reply-To
<7vsljrxbg8.fsf@assigned-by-dhcp.cox.net>
Le lundi 21 août 2006 00:57, Junio C Hamano a écrit :
Show 14 quoted lines
> 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).

Show 5 quoted lines
> 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.

Previous: Junio C Hamano
Message 4 of 4 in “Helper function to shell quote all arg values at once.”
  1. Helper function to shell quote all arg values at once.Christian Couder, Aug 20, 2006
  2. Christian CouderAug 20, 2006
  3. Junio C HamanoAug 20, 2006
  4. Christian CouderAug 21, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.