1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-08-17 17:08:20 +02:00
This commit is contained in:
Jim Meyering
1995-03-12 18:21:38 +00:00
parent 858157b65b
commit cb715fe584
+25
View File
@@ -0,0 +1,25 @@
/* memcpy.c -- copy memory.
Copy LENGTH bytes from SOURCE to DEST. Does not null-terminate.
The source and destination regions may not overlap.
In the public domain.
By Jim Meyering. */
/* FIXME: remove this before release. */
#include <assert.h>
#ifndef ABS
# define ABS(x) ((x) < 0 ? (-(x)) : (x))
#endif
void
memcpy (dest, source, length)
char *dest;
const char *source;
unsigned length;
{
assert (length >= 0);
/* Make sure they don't overlap. */
assert (ABS (dest - source) >= length);
for (; length; --length)
*dest++ = *source++;
}