public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx.manpages@gmail.com>
To: Zack Weinberg <zack@owlfolio.org>,
	GNU libc development <libc-alpha@sourceware.org>
Subject: Re: [PATCH v2 0/3] Add stpe*() functions
Date: Thu, 29 Dec 2022 11:13:07 +0100	[thread overview]
Message-ID: <d7c92180-27e6-c2cf-f6bc-9f6b36484ca2@gmail.com> (raw)
In-Reply-To: <4232dbd7-53c4-496f-92a6-1acd7f8dcd12@app.fastmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1211 bytes --]

[please CC me]

Hi Zack,

On 12/29/22 01:01, Zack Weinberg via Libc-alpha wrote:
> On Wed, Dec 28, 2022, at 6:17 PM, Alejandro Colomar via Libc-alpha wrote:
>> This version of the patch set adds the [v]stpeprintf() functions, which
>> are more necessary than stpecpy(3).  snprintf(3) is the only way to
>> catenate formatted strings, and it's really bad for that.
> 
> I don't necessarily _oppose_ the addition of these functions but I wonder
> whether the uses you have in mind would be satisfied by open_memstream() +
> fprintf().

There are uses which could be covered by it.  However, several of the cases 
where I found dubious code around snprintf(3) (when not straight bugs) can't use 
it.  Most of the use cases of snprintf(3) were legitimately truncating; for 
example, one of them was creating a path, and anything over PATH_MAX would be an 
error.  In Nginx code, performance also matters a lot, so I guess this function 
has unnecessary overhead due to realloc(3) (although I don't know how much 
that's relevant, since snprintf(3) is already quite slow).

But it's an interesting alternative; thanks!

Cheers,

Alex

> 
> zw

-- 
<http://www.alejandro-colomar.es/>

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-12-29 10:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-22 21:42 [PATCH 0/1] string: Add stpecpy(3) Alejandro Colomar
2022-12-22 21:42 ` [PATCH 1/1] " Alejandro Colomar
2022-12-23  7:02   ` Sam James
2022-12-23 12:26     ` Alejandro Colomar
2022-12-23 12:29       ` Alejandro Colomar
2022-12-23 17:21       ` Alejandro Colomar
2022-12-31 15:13       ` Sam James
2022-12-31 15:15         ` Alejandro Colomar
2022-12-28 23:17 ` [PATCH v2 0/3] Add stpe*() functions Alejandro Colomar
2022-12-29  0:01   ` Zack Weinberg
2022-12-29 10:13     ` Alejandro Colomar [this message]
2022-12-28 23:17 ` [PATCH v2 1/3] string: Add stpecpy() Alejandro Colomar
2022-12-28 23:27   ` Alejandro Colomar
2022-12-28 23:17 ` [PATCH v2 2/3] stdio: Add vstpeprintf() Alejandro Colomar
2022-12-28 23:17 ` [PATCH v2 3/3] stdio: Add stpeprintf() Alejandro Colomar
2022-12-28 23:27   ` Alejandro Colomar

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=d7c92180-27e6-c2cf-f6bc-9f6b36484ca2@gmail.com \
    --to=alx.manpages@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=zack@owlfolio.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).