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
Junio C Hamano <junkio@cox.net>
Date
Aug 20, 2006, 22:57 UTC
Message-ID
<7vsljrxbg8.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20060820080749.e31276dd.chriscool@tuxfamily.org>
Christian Couder <chriscool@tuxfamily.org> writes:
Show 5 quoted lines
> 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.

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.

Previous: Christian CouderNext: Christian Couder
Message 3 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.