From: Jim Meyering Date: Sat, 28 Jan 1995 13:09:42 +0000 (+0000) Subject: (tac): Use memmove instead of bcopy. X-Git-Tag: textutils-1_12_1~312 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=af7e99c091afefc228ed50a41a49a729bc294321;p=thirdparty%2Fcoreutils.git (tac): Use memmove instead of bcopy. (output): Use memcpy instead of bcopy. --- diff --git a/src/tac.c b/src/tac.c index b136298404..2c629ac0b2 100644 --- a/src/tac.c +++ b/src/tac.c @@ -546,8 +546,9 @@ tac (fd, file) } lseek (fd, file_pos, SEEK_SET); - /* Shift the pending record data right to make room for the new. */ - bcopy (buffer, buffer + read_size, saved_record_size); + /* Shift the pending record data right to make room for the new. + The source and destination regions probably overlap. */ + memmove (buffer + read_size, buffer, saved_record_size); past_end = buffer + read_size + saved_record_size; /* For non-regexp searches, avoid unneccessary scanning. */ if (sentinel_length) @@ -608,7 +609,7 @@ output (start, past_end) /* Write out as many full buffers as possible. */ while (bytes_to_add >= bytes_available) { - bcopy (start, buffer + bytes_in_buffer, bytes_available); + memcpy (buffer + bytes_in_buffer, start, bytes_available); bytes_to_add -= bytes_available; start += bytes_available; xwrite (STDOUT_FILENO, buffer, WRITESIZE); @@ -616,7 +617,7 @@ output (start, past_end) bytes_available = WRITESIZE; } - bcopy (start, buffer + bytes_in_buffer, bytes_to_add); + memcpy (buffer + bytes_in_buffer, start, bytes_to_add); bytes_in_buffer += bytes_to_add; }