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

Re: [PATCH 0/3] Remove sq_quote_print() in favor of *_buf

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 30, 2013, 15:00 UTC
Message-ID
<7viozsxfcd.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1375173087-2164-1-git-send-email-artagnon@gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
Show 5 quoted lines
> While going through the for-each-ref-pretty series that Duy and I were
> developing, I noticed that this cleanup was independent and good
> as-it-is.
>
> So here it is.

You always can first allocate a piece of memory and write into it instead of writing things out directly. The patch shows it _can_ be done, but that is not a news.

And such a change is hardly a "clean-up". It just wastes more memory you do not have to waste, in order to do what you are doing.

When there is a reason why you need an in-memory representation, this change starts to become the first step refactoring for an enhancement.

> Nguyễn Thái Ngọc Duy (1):
>   for-each-ref, quote: convert *_quote_print -> *_quote_buf

The log message for this one explains it very well. This change by itself is not useful, but it will become necessary once you start needing to access an in-memory result.

Previous: Ramkumar RamachandraNext: Junio C Hamano
Message 5 of 7 in “Remove sq_quote_print() in favor of *_buf”
  1. 0/3 Remove sq_quote_print() in favor of *_bufRamkumar Ramachandra, Jul 30, 2013
  2. 1/3 for-each-ref, quote: convert *_quote_print -> *_quote_bufRamkumar Ramachandra, Jul 30, 2013
  3. 2/3 tar-tree: remove dependency on sq_quote_print()Ramkumar Ramachandra, Jul 30, 2013
  4. 3/3 quote: remove sq_quote_print()Ramkumar Ramachandra, Jul 30, 2013
  5. Junio C HamanoJul 30, 2013
  6. Junio C HamanoJul 30, 2013
  7. Ramkumar RamachandraJul 30, 2013

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.