git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>,
	 git@vger.kernel.org, ps@pks.im,  karthik.188@gmail.com
Subject: Re: [PATCH v3 1/2] repo: factor out field printing to dedicated function
Date: Mon, 27 Oct 2025 07:56:35 -0700	[thread overview]
Message-ID: <xmqqwm4gl7fg.fsf@gitster.g> (raw)
In-Reply-To: <CAPig+cRHKySZ+JPs3G0HowdCEJmE9fP=tCFB=DV-KMPknKTZkQ@mail.gmail.com> (Eric Sunshine's message of "Sun, 26 Oct 2025 19:56:47 -0400")

Eric Sunshine <sunshine@sunshineco.com> writes:

> Or, even better, scope the strbuf just to the `case` branch which needs it:
>
>     case FORMAT_KEYVALUE: {
>         struct strbuf buf = STRBUF_INIT;
>         quote_c_style(value, buf, NULL, 0);
>         printf("%s=%s\n", key, buf->buf);
>         strbuf_release(&buf);
>         break;
>      }

Yuck.  

For something simple like this, quote_c_style() can take "FILE *"
instead of struct "strbuf *" so that you do not have to allocate;
especially without any need for i18n, perhaps

    printf("%s=", key);
    quote_c_style(value, NULL, stdout, 0);

is sufficient?


  reply	other threads:[~2025-10-27 14:56 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-15 22:36 [PATCH] repo: add --all to git-repo-info Lucas Seiki Oshiro
2025-09-15 23:58 ` Junio C Hamano
2025-09-16  8:06 ` Patrick Steinhardt
2025-09-16 16:19   ` Junio C Hamano
2025-09-17  5:34     ` Patrick Steinhardt
2025-10-26 22:52 ` [PATCH v3 0/2] " Lucas Seiki Oshiro
2025-10-26 22:52   ` [PATCH v3 1/2] repo: factor out field printing to dedicated function Lucas Seiki Oshiro
2025-10-26 23:53     ` Eric Sunshine
2025-10-26 23:56       ` Eric Sunshine
2025-10-27 14:56         ` Junio C Hamano [this message]
2025-10-27 16:09           ` Eric Sunshine
2025-10-26 22:52   ` [PATCH v3 2/2] repo: add --all to git-repo-info Lucas Seiki Oshiro
2025-10-27  0:22     ` Eric Sunshine
2025-10-27  0:24       ` Eric Sunshine
2025-11-17 15:02 ` [PATCH v4 0/2] " Lucas Seiki Oshiro
2025-11-17 15:02   ` [PATCH v4 1/2] repo: factor out field printing to dedicated function Lucas Seiki Oshiro
2025-11-17 18:48     ` Junio C Hamano
2025-11-17 15:02   ` [PATCH v4 2/2] repo: add --all to git-repo-info Lucas Seiki Oshiro
2025-11-17 18:58     ` Junio C Hamano
2025-11-18 20:16       ` Lucas Seiki Oshiro
2025-11-18 21:28         ` Junio C Hamano
2025-11-20 22:50           ` Lucas Seiki Oshiro
2025-11-19  7:32       ` Eric Sunshine
2025-11-19 14:33         ` Junio C Hamano
2025-11-17 18:14   ` [PATCH v4 0/2] " Junio C Hamano
2025-11-18 20:37 ` [PATCH v5 " Lucas Seiki Oshiro
2025-11-18 20:37   ` [PATCH v5 1/2] repo: factor out field printing to dedicated function Lucas Seiki Oshiro
2025-11-18 20:37   ` [PATCH v5 2/2] repo: add --all to git-repo-info Lucas Seiki Oshiro
2025-11-18 21:34   ` [PATCH v5 0/2] " Junio C Hamano
2025-11-19  7:35     ` Eric Sunshine

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=xmqqwm4gl7fg.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=karthik.188@gmail.com \
    --cc=lucasseikioshiro@gmail.com \
    --cc=ps@pks.im \
    --cc=sunshine@sunshineco.com \
    /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).