Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/string/bcopy.c
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | |||||
* This is the routine that actually implements | * This is the routine that actually implements | ||||
* (the portable versions of) bcopy, memcpy, and memmove. | * (the portable versions of) bcopy, memcpy, and memmove. | ||||
*/ | */ | ||||
#if defined(MEMCOPY) || defined(MEMMOVE) | #if defined(MEMCOPY) || defined(MEMMOVE) | ||||
#include <string.h> | #include <string.h> | ||||
void * | void * | ||||
#ifdef MEMCOPY | #ifdef MEMCOPY | ||||
memcpy | (memcpy) | ||||
#else | #else | ||||
memmove | (memmove) | ||||
#endif | #endif | ||||
(void *dst0, const void *src0, size_t length) | (void *dst0, const void *src0, size_t length) | ||||
#else | #else | ||||
#include <strings.h> | #include <strings.h> | ||||
void | void | ||||
bcopy(const void *src0, void *dst0, size_t length) | (bcopy)(const void *src0, void *dst0, size_t length) | ||||
#endif | #endif | ||||
{ | { | ||||
char *dst = dst0; | char *dst = dst0; | ||||
const char *src = src0; | const char *src = src0; | ||||
size_t t; | size_t t; | ||||
if (length == 0 || dst == src) /* nothing to do */ | if (length == 0 || dst == src) /* nothing to do */ | ||||
goto done; | goto done; | ||||
▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines |