Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] string.c: prefer memcpy() over strcpy()





On Tue, Jan 2, 2024 at 7:24 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
This may be a worthwhile optimization given how frequently
dupstring/ztrdup/dyncat are used, but I'm concerned that "WLEN" may be
confused with counts of wide characters.

STRNCPY_NUL() or even ZSTRNCPY() ?
I was using WLEN based on dupstring_wlen(). I don't think strncpy() is a good name because it's already an extension that behaves very differently. According to the Linux man page: these functions [strncpy and stpncpy] copy the string pointed to by src into a null-padded character sequence at the fixed-width buffer pointed to by dst.


Messages sorted by: Reverse Date, Date, Thread, Author