![]() |
|
Message-ID: <twdnen3jsgplkmkcvjrsnm3nup227ym2lhrquhxqbufym7vhlq@uys2bbvticnu>
Date: Sat, 5 Jul 2025 03:45:23 +0200
From: Alejandro Colomar <alx@...nel.org>
To: Collin Funk <collin.funk1@...il.com>
Cc: Eric Blake <eblake@...hat.com>, Rich Felker <dalias@...c.org>,
enh <enh@...gle.com>, Florian Weimer <fweimer@...hat.com>,
Adhemerval Zanella Netto <adhemerval.zanella@...aro.org>, musl@...ts.openwall.com, libc-alpha@...rceware.org,
Joseph Myers <josmyers@...hat.com>, наб <nabijaczleweli@...ijaczleweli.xyz>,
Paul Eggert <eggert@...ucla.edu>, Robert Seacord <rcseacord@...il.com>,
Bruno Haible <bruno@...sp.org>, bug-gnulib@....org, JeanHeyd Meneide <phdofthehouse@...il.com>
Subject: Re: Re: BUG: realloc(p,0) should be consistent with malloc(0)
Hi Collin,
On Sat, Jul 05, 2025 at 02:44:02AM +0200, Alejandro Colomar wrote:
> > You can look for yourself here, <https://www.tuhs.org/cgi-bin/utree.pl>.
Hmmm, I've only found definitions, but no uses at all. All definitions
seem to be there for compatibility with SysV. I wonder what SysV had
this API for. I guess it was for some networking code, as the function
seems to be for copying part of a string until a delimiter, and
appending a terminator after it (but including it in the new string).
Something like:
char uri[] = "https://www.example.es";
char scheme[countof(uri)];
p = memccpy(scheme, uri, ':', countof(uri));
if (p == NULL)
goto hell;
p = '\0';
// Here, scheme is "https:"
This would make sense, although it would be interesting to see the exact
use case they had for it. I'm pretty certain it was not the use case
that was envisioned by the C Committee when they standardized it in C23.
Cheers,
Alex
--
<https://www.alejandro-colomar.es/>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.