locale: use memmove for potentially overlapping data
Paul Eggert
eggert@cs.ucla.edu
Thu Nov 7 03:57:03 GMT 2024
On 2024-11-06 18:31, DJ Delorie wrote:
> - memcpy (ctx->buffer, &ctx->buffer[64], left_over);
> + memmove (ctx->buffer, &ctx->buffer[64], left_over);
left_over <= 64 so it's not an overlapping move. Making the change will
make the code more confusing, as readers might wonder "Why use memmove
when the move is non-overlapping?"
> Use memmove instead of memcpy just in case
By that argument, shouldn't every call to memcpy be replaced by memmove?
More information about the Libc-alpha
mailing list