[musl] Re: BUG: realloc(p,0) should be consistent with malloc(0)
Collin Funk
collin.funk1@gmail.com
Sat Jul 5 00:15:27 GMT 2025
Alejandro Colomar <alx@kernel.org> writes:
> BTW, I was trying to find out the history of memccpy(3), and why it was
> introduced in 4.4BSD. Does anyone know the history? I find it a weird
> function that doesn't have any good use case, or I don't seem to see it.
> Every use case I see, such as a poor-man's strlcpy(3), seems to be prone
> to off-by-one errors, or have other APIs that would be more ergonomic.
> What were the original uses in 4.4BSD?
In the sources for 2.11 BSD you can find the following in
include/strings.h:
/* Routines described in memory(BA_LIB); System V compatibility */
char *memccpy(), *memchr(), *memcpy(), *memset(), *strchr(),
*strdup(), *strpbrk(), *strrchr(), *strsep(), *strtok();
The first time I can see the function defined is in Eigth Edition Unix.
You can look for yourself here, <https://www.tuhs.org/cgi-bin/utree.pl>.
Collin
More information about the Libc-alpha
mailing list