Module Name:    src
Committed By:   christos
Date:           Tue Aug  1 17:51:25 UTC 2023

Modified Files:
        src/distrib/sets/lists/comp: mi
        src/include: string.h
        src/lib/libc: shlib_version
        src/lib/libc/string: Makefile.inc memcpy.3
Added Files:
        src/lib/libc/string: mempcpy.c

Log Message:
Add companion mempcpy to wmempcpy, bump.


To generate a diff of this commit:
cvs rdiff -u -r1.2440 -r1.2441 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.53 -r1.54 src/include/string.h
cvs rdiff -u -r1.294 -r1.295 src/lib/libc/shlib_version
cvs rdiff -u -r1.86 -r1.87 src/lib/libc/string/Makefile.inc
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/string/memcpy.3
cvs rdiff -u -r0 -r1.1 src/lib/libc/string/mempcpy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2440 src/distrib/sets/lists/comp/mi:1.2441
--- src/distrib/sets/lists/comp/mi:1.2440	Tue Aug  1 02:35:55 2023
+++ src/distrib/sets/lists/comp/mi	Tue Aug  1 13:51:24 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2440 2023/08/01 06:35:55 mrg Exp $
+#	$NetBSD: mi,v 1.2441 2023/08/01 17:51:24 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.comp				comp-sys-root
@@ -9199,6 +9199,7 @@
 ./usr/share/man/cat3/memmem.0			comp-c-catman		.cat
 ./usr/share/man/cat3/memmove.0			comp-c-catman		.cat
 ./usr/share/man/cat3/memory.0			comp-c-catman		.cat
+./usr/share/man/cat3/mempcpy.0			comp-c-catman		.cat
 ./usr/share/man/cat3/memrchr.0			comp-c-catman		.cat
 ./usr/share/man/cat3/memset.0			comp-c-catman		.cat
 ./usr/share/man/cat3/menu_attributes.0		comp-c-catman		.cat
@@ -17622,6 +17623,7 @@
 ./usr/share/man/html3/memmem.html		comp-c-htmlman		html
 ./usr/share/man/html3/memmove.html		comp-c-htmlman		html
 ./usr/share/man/html3/memory.html		comp-c-htmlman		html
+./usr/share/man/html3/mempcpy.html		comp-c-htmlman		html
 ./usr/share/man/html3/memrchr.html		comp-c-htmlman		html
 ./usr/share/man/html3/memset.html		comp-c-htmlman		html
 ./usr/share/man/html3/menu_attributes.html	comp-c-htmlman		html
@@ -26052,6 +26054,7 @@
 ./usr/share/man/man3/memmem.3			comp-c-man		.man
 ./usr/share/man/man3/memmove.3			comp-c-man		.man
 ./usr/share/man/man3/memory.3			comp-c-man		.man
+./usr/share/man/man3/mempcpy.3			comp-c-man		.man
 ./usr/share/man/man3/memrchr.3			comp-c-man		.man
 ./usr/share/man/man3/memset.3			comp-c-man		.man
 ./usr/share/man/man3/menu_attributes.3		comp-c-man		.man

Index: src/include/string.h
diff -u src/include/string.h:1.53 src/include/string.h:1.54
--- src/include/string.h:1.53	Mon Aug  9 16:49:08 2021
+++ src/include/string.h	Tue Aug  1 13:51:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: string.h,v 1.53 2021/08/09 20:49:08 andvar Exp $	*/
+/*	$NetBSD: string.h,v 1.54 2023/08/01 17:51:24 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -106,6 +106,7 @@ char	*strsep(char **, const char *);
 char	*stresep(char **, const char *, int);
 char	*strnstr(const char *, const char *, size_t);
 void	*memrchr(const void *, int, size_t);
+void	*mempcpy(void * __restrict, const void * __restrict, size_t);
 void	*explicit_memset(void *, int, size_t);
 int	consttime_memequal(const void *, const void *, size_t);
 __END_DECLS

Index: src/lib/libc/shlib_version
diff -u src/lib/libc/shlib_version:1.294 src/lib/libc/shlib_version:1.295
--- src/lib/libc/shlib_version:1.294	Sat Jul  1 20:52:04 2023
+++ src/lib/libc/shlib_version	Tue Aug  1 13:51:24 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: shlib_version,v 1.294 2023/07/02 00:52:04 dholland Exp $
+#	$NetBSD: shlib_version,v 1.295 2023/08/01 17:51:24 christos Exp $
 #	Remember to update distrib/sets/lists/base/shl.* when changing
 #
 # things we wish to do on next major version bump:
@@ -55,4 +55,4 @@
 # - remove tzsetwall(3), upstream has removed it
 # - move *rand48* to libcompat
 major=12
-minor=220
+minor=221

Index: src/lib/libc/string/Makefile.inc
diff -u src/lib/libc/string/Makefile.inc:1.86 src/lib/libc/string/Makefile.inc:1.87
--- src/lib/libc/string/Makefile.inc:1.86	Mon Jul 31 13:38:28 2023
+++ src/lib/libc/string/Makefile.inc	Tue Aug  1 13:51:25 2023
@@ -1,5 +1,5 @@
 #	from: @(#)Makefile.inc	8.1 (Berkeley) 6/4/93
-#	$NetBSD: Makefile.inc,v 1.86 2023/07/31 17:38:28 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.87 2023/08/01 17:51:25 christos Exp $
 
 # string sources
 .PATH: ${ARCHDIR}/string ${.CURDIR}/string
@@ -21,7 +21,7 @@ SRCS+=	strncat.c strncmp.c strncpy.c str
 SRCS+=	strspn.c strstr.c swab.c strnstr.c
 SRCS+=	explicit_memset.c consttime_memequal.c
 
-SRCS+=	memccpy.c memcpy.c memmem.c memmove.c
+SRCS+=	memccpy.c memcpy.c memmem.c memmove.c mempcpy.c
 SRCS+=	strchr.c strrchr.c strchrnul.c
 SRCS+=	popcount32.c popcount64.c
 
@@ -67,6 +67,7 @@ MLINKS+=strstr.3 strcasestr.3
 MLINKS+=strstr.3 strnstr.3
 MLINKS+=strchr.3 strchrnul.3
 MLINKS+=memchr.3 memrchr.3
+MLINKS+=memcpy.3 mempcpy.3
 MLINKS+=strtok.3 strtok_r.3
 MLINKS+=strerror.3 strerror_r.3 strerror.3 perror.3 \
 	strerror.3 strerror_l.3 \

Index: src/lib/libc/string/memcpy.3
diff -u src/lib/libc/string/memcpy.3:1.13 src/lib/libc/string/memcpy.3:1.14
--- src/lib/libc/string/memcpy.3:1.13	Mon Sep  8 13:54:33 2003
+++ src/lib/libc/string/memcpy.3	Tue Aug  1 13:51:25 2023
@@ -30,9 +30,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     from: @(#)memcpy.3	8.1 (Berkeley) 6/4/93
-.\"	$NetBSD: memcpy.3,v 1.13 2003/09/08 17:54:33 wiz Exp $
+.\"	$NetBSD: memcpy.3,v 1.14 2023/08/01 17:51:25 christos Exp $
 .\"
-.Dd June 4, 1993
+.Dd August 1, 2023
 .Dt MEMCPY 3
 .Os
 .Sh NAME
@@ -44,11 +44,15 @@
 .In string.h
 .Ft void *
 .Fn memcpy "void * restrict dst" "const void * restrict src" "size_t len"
+.Ft void *
+.Fn mempcpy "void *restrict dst" "const void * restrict src" "size_t len"
 .Sh DESCRIPTION
 The
 .Fn memcpy
-function
-copies
+and
+.Fn mempcpy
+functions
+copy
 .Fa len
 bytes from string
 .Fa src
@@ -63,12 +67,17 @@ The
 .Fn memcpy
 function
 returns the original value of
+.Pp
+The
+.Fn mempcpy
+function returns a pointer to the byte after the last written byte.
 .Fa dst .
 .Sh SEE ALSO
 .Xr bcopy 3 ,
 .Xr memccpy 3 ,
 .Xr memmove 3 ,
-.Xr strcpy 3
+.Xr wmemcpy 3 ,
+.Xr wmempcpy 3
 .Sh STANDARDS
 The
 .Fn memcpy

Added files:

Index: src/lib/libc/string/mempcpy.c
diff -u /dev/null src/lib/libc/string/mempcpy.c:1.1
--- /dev/null	Tue Aug  1 13:51:25 2023
+++ src/lib/libc/string/mempcpy.c	Tue Aug  1 13:51:25 2023
@@ -0,0 +1,37 @@
+/*	$NetBSD: mempcpy.c,v 1.1 2023/08/01 17:51:25 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2023 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 <sys/cdefs.h>
+__RCSID("$NetBSD: mempcpy.c,v 1.1 2023/08/01 17:51:25 christos Exp $");
+
+#include <string.h>
+
+void *
+mempcpy(void *__restrict dst, const void *__restrict src, size_t len)
+{
+	return (char *)memcpy(dst, src, len) + len;
+}

Reply via email to