memmove.c\string\src - musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src/string/memmove.c
blob: 22bb4b3559d3e76a8f064028925352f78a735ab8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <string.h>
void *memmove(void *dest, const void *src, size_t n)
{
	char *d = dest;
	const char *s = src;
	if (d==s) return d;
	if ((size_t)(d-s) < n) {
		while (n--) d[n] = s[n];
		return dest;
	}
	/* Assumes memcpy is overlap-safe when dest < src */
	return memcpy(d, s, n);
}
generated by cgit v1.2.1 (git 2.18.0) at 2025年10月04日 21:03:10 +0000

AltStyle によって変換されたページ (->オリジナル) /