* commit 'dedacf109b35e74d76594c29560a09f4ef3eb94d': Clean up <stdlib.h> slightly.
This commit is contained in:
		@@ -271,7 +271,6 @@ libc_upstream_freebsd_src_files := \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcsspn.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wcstok.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wmemchr.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wmemcpy.c \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wmemset.c \
 | 
			
		||||
 | 
			
		||||
libc_upstream_netbsd_src_files := \
 | 
			
		||||
@@ -506,6 +505,7 @@ libc_upstream_openbsd_src_files := \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strspn.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strstr.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strtok.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/wmemcpy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/wcslcpy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/wcsstr.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/wcswidth.c \
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,6 @@ libc_freebsd_src_files_arm += \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wmemmove.c \
 | 
			
		||||
 | 
			
		||||
libc_openbsd_src_files_arm += \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/bcopy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/stpncpy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strlcat.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strlcpy.c \
 | 
			
		||||
 
 | 
			
		||||
@@ -9,4 +9,6 @@ libc_bionic_src_files_arm += \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/strcpy.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/__strcpy_chk.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/strlen.S \
 | 
			
		||||
    bionic/memmove.c \
 | 
			
		||||
 | 
			
		||||
libc_openbsd_src_files_arm += \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/memmove.c \
 | 
			
		||||
 
 | 
			
		||||
@@ -9,4 +9,6 @@ libc_bionic_src_files_arm += \
 | 
			
		||||
    arch-arm/cortex-a9/bionic/strcpy.S \
 | 
			
		||||
    arch-arm/cortex-a9/bionic/__strcpy_chk.S \
 | 
			
		||||
    arch-arm/cortex-a9/bionic/strlen.S \
 | 
			
		||||
    bionic/memmove.c \
 | 
			
		||||
 | 
			
		||||
libc_openbsd_src_files_arm += \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/memmove.c \
 | 
			
		||||
 
 | 
			
		||||
@@ -5,8 +5,10 @@ libc_bionic_src_files_arm += \
 | 
			
		||||
    arch-arm/generic/bionic/strcmp.S \
 | 
			
		||||
    arch-arm/generic/bionic/strcpy.S \
 | 
			
		||||
    arch-arm/generic/bionic/strlen.c \
 | 
			
		||||
    bionic/memmove.c \
 | 
			
		||||
    bionic/__strcat_chk.cpp \
 | 
			
		||||
    bionic/__strcpy_chk.cpp \
 | 
			
		||||
 | 
			
		||||
libc_openbsd_src_files_arm += \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/memmove.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/stpcpy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strcat.c \
 | 
			
		||||
 
 | 
			
		||||
@@ -12,4 +12,6 @@ libc_bionic_src_files_arm += \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/strcat.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/strcpy.S \
 | 
			
		||||
    arch-arm/cortex-a15/bionic/strlen.S \
 | 
			
		||||
    bionic/memmove.c \
 | 
			
		||||
 | 
			
		||||
libc_openbsd_src_files_arm += \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/memmove.c \
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,6 @@ libc_bionic_src_files_mips += \
 | 
			
		||||
    bionic/__strcat_chk.cpp \
 | 
			
		||||
    bionic/memchr.c \
 | 
			
		||||
    bionic/memcmp.c \
 | 
			
		||||
    bionic/memmove.c \
 | 
			
		||||
    bionic/memrchr.c \
 | 
			
		||||
    bionic/strchr.cpp \
 | 
			
		||||
    bionic/strnlen.c \
 | 
			
		||||
@@ -46,7 +45,7 @@ libc_freebsd_src_files_mips += \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wmemmove.c \
 | 
			
		||||
 | 
			
		||||
libc_openbsd_src_files_mips += \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/bcopy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/memmove.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/stpcpy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/stpncpy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strcat.c \
 | 
			
		||||
@@ -79,10 +78,10 @@ libc_bionic_src_files_mips += \
 | 
			
		||||
 | 
			
		||||
else
 | 
			
		||||
libc_bionic_src_files_mips += \
 | 
			
		||||
    bionic/memcpy.cpp \
 | 
			
		||||
    bionic/memset.c \
 | 
			
		||||
 | 
			
		||||
libc_openbsd_src_files_mips += \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/memcpy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strlen.c \
 | 
			
		||||
 | 
			
		||||
endif
 | 
			
		||||
 
 | 
			
		||||
@@ -11,8 +11,6 @@ libc_bionic_src_files_mips64 += \
 | 
			
		||||
    bionic/__strcat_chk.cpp \
 | 
			
		||||
    bionic/memchr.c \
 | 
			
		||||
    bionic/memcmp.c \
 | 
			
		||||
    bionic/memcpy.cpp \
 | 
			
		||||
    bionic/memmove.c \
 | 
			
		||||
    bionic/memrchr.c \
 | 
			
		||||
    bionic/memset.c \
 | 
			
		||||
    bionic/strchr.cpp \
 | 
			
		||||
@@ -30,6 +28,8 @@ libc_freebsd_src_files_mips64 += \
 | 
			
		||||
    upstream-freebsd/lib/libc/string/wmemmove.c \
 | 
			
		||||
 | 
			
		||||
libc_openbsd_src_files_mips64 += \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/memcpy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/memmove.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/stpcpy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/stpncpy.c \
 | 
			
		||||
    upstream-openbsd/lib/libc/string/strcat.c \
 | 
			
		||||
 
 | 
			
		||||
@@ -31,6 +31,7 @@
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
unsigned int error_message_count = 0;
 | 
			
		||||
void (*error_print_progname)(void) = NULL;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,38 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2008 The Android Open Source Project
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 *  * Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 *  * Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in
 | 
			
		||||
 *    the documentation and/or other materials provided with the
 | 
			
		||||
 *    distribution.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 | 
			
		||||
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 | 
			
		||||
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 | 
			
		||||
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 | 
			
		||||
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 | 
			
		||||
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 | 
			
		||||
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 | 
			
		||||
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 | 
			
		||||
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 | 
			
		||||
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 | 
			
		||||
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#undef _FORTIFY_SOURCE
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <strings.h>
 | 
			
		||||
 | 
			
		||||
// Our unoptimized memcpy just calls the best bcopy available.
 | 
			
		||||
// (It's this way round rather than the opposite because we're based on BSD source.)
 | 
			
		||||
void* memcpy(void* dst, const void* src, size_t n) {
 | 
			
		||||
  bcopy(src, dst, n);
 | 
			
		||||
  return dst;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,30 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2008 The Android Open Source Project
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 *  * Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 *  * Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in
 | 
			
		||||
 *    the documentation and/or other materials provided with the
 | 
			
		||||
 *    distribution.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 | 
			
		||||
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 | 
			
		||||
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 | 
			
		||||
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 | 
			
		||||
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 | 
			
		||||
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 | 
			
		||||
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 | 
			
		||||
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 | 
			
		||||
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 | 
			
		||||
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 | 
			
		||||
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define MEMMOVE
 | 
			
		||||
#include "upstream-openbsd/lib/libc/string/bcopy.c"
 | 
			
		||||
@@ -235,6 +235,12 @@ extern "C" sighandler_t bsd_signal(int signum, sighandler_t handler) {
 | 
			
		||||
  return signal(signum, handler);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// This was removed from POSIX 2008.
 | 
			
		||||
#undef bcopy
 | 
			
		||||
extern "C" void bcopy(const void* src, void* dst, size_t n) {
 | 
			
		||||
  memcpy(dst, src, n);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// sysv_signal() was never in POSIX.
 | 
			
		||||
extern sighandler_t _signal(int signum, sighandler_t handler, int flags);
 | 
			
		||||
extern "C" sighandler_t sysv_signal(int signum, sighandler_t handler) {
 | 
			
		||||
 
 | 
			
		||||
@@ -18,6 +18,7 @@
 | 
			
		||||
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
#include "private/bionic_macros.h"
 | 
			
		||||
#include "private/ScopedReaddir.h"
 | 
			
		||||
 
 | 
			
		||||
@@ -16,6 +16,7 @@
 | 
			
		||||
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <syslog.h>
 | 
			
		||||
 | 
			
		||||
#include "private/libc_logging.h"
 | 
			
		||||
 
 | 
			
		||||
@@ -34,6 +34,7 @@
 | 
			
		||||
#include "resolv_cache.h"
 | 
			
		||||
#include <pthread.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
 | 
			
		||||
#include <sys/_system_properties.h>
 | 
			
		||||
 
 | 
			
		||||
@@ -25,15 +25,16 @@
 | 
			
		||||
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef _STDLIB_H_
 | 
			
		||||
#define _STDLIB_H_
 | 
			
		||||
 | 
			
		||||
#ifndef _STDLIB_H
 | 
			
		||||
#define _STDLIB_H
 | 
			
		||||
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
#include <xlocale.h>
 | 
			
		||||
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
#include <alloca.h>
 | 
			
		||||
#include <strings.h>
 | 
			
		||||
#include <memory.h>
 | 
			
		||||
#include <malloc.h>
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
 | 
			
		||||
__BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
@@ -173,4 +174,4 @@ extern size_t __ctype_get_mb_cur_max(void);
 | 
			
		||||
 | 
			
		||||
__END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* _STDLIB_H_ */
 | 
			
		||||
#endif /* _STDLIB_H */
 | 
			
		||||
 
 | 
			
		||||
@@ -36,6 +36,10 @@
 | 
			
		||||
 | 
			
		||||
__BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
#if defined(__USE_BSD)
 | 
			
		||||
#include <strings.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
extern void*  memccpy(void* __restrict, const void* __restrict, int, size_t);
 | 
			
		||||
extern void*  memchr(const void *, int, size_t) __purefunc;
 | 
			
		||||
extern void*  memrchr(const void *, int, size_t) __purefunc;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										99
									
								
								libc/upstream-openbsd/lib/libc/string/memcpy.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										99
									
								
								libc/upstream-openbsd/lib/libc/string/memcpy.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,99 @@
 | 
			
		||||
/*	$OpenBSD: memcpy.c,v 1.1 2014/11/30 19:43:56 deraadt Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990 The Regents of the University of California.
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * This code is derived from software contributed to Berkeley by
 | 
			
		||||
 * Chris Torek.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 * 1. Redistributions of source code must retain the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer.
 | 
			
		||||
 * 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
 *    notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
 *    documentation and/or other materials provided with the distribution.
 | 
			
		||||
 * 3. Neither the name of the University nor the names of its contributors
 | 
			
		||||
 *    may be used to endorse or promote products derived from this software
 | 
			
		||||
 *    without specific prior written permission.
 | 
			
		||||
 *
 | 
			
		||||
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 | 
			
		||||
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
			
		||||
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 | 
			
		||||
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 | 
			
		||||
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 | 
			
		||||
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 | 
			
		||||
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
			
		||||
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 | 
			
		||||
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 | 
			
		||||
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
 * SUCH DAMAGE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <syslog.h>
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * sizeof(word) MUST BE A POWER OF TWO
 | 
			
		||||
 * SO THAT wmask BELOW IS ALL ONES
 | 
			
		||||
 */
 | 
			
		||||
typedef	long word;		/* "word" used for optimal copy speed */
 | 
			
		||||
 | 
			
		||||
#define	wsize	sizeof(word)
 | 
			
		||||
#define	wmask	(wsize - 1)
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copy a block of memory, not handling overlap.
 | 
			
		||||
 */
 | 
			
		||||
void *
 | 
			
		||||
memcpy(void *dst0, const void *src0, size_t length)
 | 
			
		||||
{
 | 
			
		||||
	char *dst = dst0;
 | 
			
		||||
	const char *src = src0;
 | 
			
		||||
	size_t t;
 | 
			
		||||
 | 
			
		||||
	if (length == 0 || dst == src)		/* nothing to do */
 | 
			
		||||
		goto done;
 | 
			
		||||
 | 
			
		||||
	if ((dst < src && dst + length > src) ||
 | 
			
		||||
	    (src < dst && src + length > dst)) {
 | 
			
		||||
		struct syslog_data sdata = SYSLOG_DATA_INIT;
 | 
			
		||||
 | 
			
		||||
		syslog_r(LOG_CRIT, &sdata, "backwards memcpy");
 | 
			
		||||
		abort();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Macros: loop-t-times; and loop-t-times, t>0
 | 
			
		||||
	 */
 | 
			
		||||
#define	TLOOP(s) if (t) TLOOP1(s)
 | 
			
		||||
#define	TLOOP1(s) do { s; } while (--t)
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Copy forward.
 | 
			
		||||
	 */
 | 
			
		||||
	t = (long)src;	/* only need low bits */
 | 
			
		||||
	if ((t | (long)dst) & wmask) {
 | 
			
		||||
		/*
 | 
			
		||||
		 * Try to align operands.  This cannot be done
 | 
			
		||||
		 * unless the low bits match.
 | 
			
		||||
		 */
 | 
			
		||||
		if ((t ^ (long)dst) & wmask || length < wsize)
 | 
			
		||||
			t = length;
 | 
			
		||||
		else
 | 
			
		||||
			t = wsize - (t & wmask);
 | 
			
		||||
		length -= t;
 | 
			
		||||
		TLOOP1(*dst++ = *src++);
 | 
			
		||||
	}
 | 
			
		||||
	/*
 | 
			
		||||
	 * Copy whole words, then mop up any trailing bytes.
 | 
			
		||||
	 */
 | 
			
		||||
	t = length / wsize;
 | 
			
		||||
	TLOOP(*(word *)dst = *(word *)src; src += wsize; dst += wsize);
 | 
			
		||||
	t = length & wmask;
 | 
			
		||||
	TLOOP(*dst++ = *src++);
 | 
			
		||||
done:
 | 
			
		||||
	return (dst0);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
/*	$OpenBSD: bcopy.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */
 | 
			
		||||
/*	$OpenBSD: memmove.c,v 1.1 2014/11/30 19:43:56 deraadt Exp $ */
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 1990 The Regents of the University of California.
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
@@ -44,21 +44,9 @@ typedef	long word;		/* "word" used for optimal copy speed */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copy a block of memory, handling overlap.
 | 
			
		||||
 * This is the routine that actually implements
 | 
			
		||||
 * (the portable versions of) bcopy, memcpy, and memmove.
 | 
			
		||||
 */
 | 
			
		||||
#ifdef MEMCOPY
 | 
			
		||||
void *
 | 
			
		||||
memcpy(void *dst0, const void *src0, size_t length)
 | 
			
		||||
#else
 | 
			
		||||
#ifdef MEMMOVE
 | 
			
		||||
void *
 | 
			
		||||
memmove(void *dst0, const void *src0, size_t length)
 | 
			
		||||
#else
 | 
			
		||||
void
 | 
			
		||||
bcopy(const void *src0, void *dst0, size_t length)
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
{
 | 
			
		||||
	char *dst = dst0;
 | 
			
		||||
	const char *src = src0;
 | 
			
		||||
@@ -120,9 +108,5 @@ bcopy(const void *src0, void *dst0, size_t length)
 | 
			
		||||
		TLOOP(*--dst = *--src);
 | 
			
		||||
	}
 | 
			
		||||
done:
 | 
			
		||||
#if defined(MEMCOPY) || defined(MEMMOVE)
 | 
			
		||||
	return (dst0);
 | 
			
		||||
#else
 | 
			
		||||
	return;
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
@@ -1,3 +1,6 @@
 | 
			
		||||
/*	$OpenBSD: wmemcpy.c,v 1.3 2005/08/08 08:05:37 espie Exp $	*/
 | 
			
		||||
/*	$NetBSD: wmemcpy.c,v 1.2 2001/01/03 14:29:37 lukem Exp $	*/
 | 
			
		||||
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c)1999 Citrus Project,
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
@@ -26,19 +29,12 @@
 | 
			
		||||
 *	citrus Id: wmemcpy.c,v 1.2 2000/12/20 14:08:31 itojun Exp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
#if 0
 | 
			
		||||
#if defined(LIBC_SCCS) && !defined(lint)
 | 
			
		||||
__RCSID("$NetBSD: wmemcpy.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
 | 
			
		||||
#endif /* LIBC_SCCS and not lint */
 | 
			
		||||
#endif
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <wchar.h>
 | 
			
		||||
 | 
			
		||||
wchar_t *
 | 
			
		||||
wmemcpy(wchar_t * __restrict d, const wchar_t * __restrict s, size_t n)
 | 
			
		||||
wmemcpy(wchar_t *d, const wchar_t *s, size_t n)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	return (wchar_t *)memcpy(d, s, n * sizeof(wchar_t));
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user