This is the mail archive of the newlib-cvs@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[newlib-cygwin] string: add wmempcpy


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=8a94bca694a6b6eb259f191922e0ef2ac9afc60a

commit 8a94bca694a6b6eb259f191922e0ef2ac9afc60a
Author: Yaakov Selkowitz <yselkowi@redhat.com>
Date:   Wed Nov 29 19:45:56 2017 -0600

    string: add wmempcpy
    
    Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>

Diff:
---
 newlib/libc/include/wchar.h      |  4 +++
 newlib/libc/string/Makefile.am   |  5 +--
 newlib/libc/string/Makefile.in   | 67 +++++++++++++++++++---------------------
 newlib/libc/string/wcstrings.tex |  4 +++
 newlib/libc/string/wmempcpy.c    | 43 ++++++++++++++++++++++++++
 5 files changed, 85 insertions(+), 38 deletions(-)

diff --git a/newlib/libc/include/wchar.h b/newlib/libc/include/wchar.h
index 25ee9a8..16e28f4 100644
--- a/newlib/libc/include/wchar.h
+++ b/newlib/libc/include/wchar.h
@@ -186,6 +186,10 @@ int	_EXFUN(wmemcmp, (const wchar_t *, const wchar_t *, size_t));
 wchar_t	*_EXFUN(wmemcpy, (wchar_t *__restrict, const wchar_t *__restrict,
 				 size_t));
 wchar_t	*_EXFUN(wmemmove, (wchar_t *, const wchar_t *, size_t));
+#if __GNU_VISIBLE
+wchar_t	*_EXFUN(wmempcpy, (wchar_t *__restrict, const wchar_t *__restrict,
+				 size_t));
+#endif
 wchar_t	*_EXFUN(wmemset, (wchar_t *, wchar_t, size_t));
 
 long    _EXFUN(wcstol, (const wchar_t *__restrict, wchar_t **__restrict, int));
diff --git a/newlib/libc/string/Makefile.am b/newlib/libc/string/Makefile.am
index a21e3d5..49de080 100644
--- a/newlib/libc/string/Makefile.am
+++ b/newlib/libc/string/Makefile.am
@@ -125,7 +125,8 @@ ELIX_4_SOURCES = \
 	wcscoll_l.c \
 	wcsncasecmp.c \
 	wcsncasecmp_l.c \
-	wcsxfrm_l.c
+	wcsxfrm_l.c \
+	wmempcpy.c
 endif !ELIX_LEVEL_3
 endif !ELIX_LEVEL_2
 endif !ELIX_LEVEL_1
@@ -164,6 +165,6 @@ wmemcmp.def	wmemcpy.def	wmemmove.def	wmemset.def \
 memmem.def	memrchr.def	rawmemchr.def	strchrnul.def \
 strcasecmp_l.def strcoll_l.def	strncasecmp_l.def strxfrm_l.def \
 wcscasecmp_l.def wcscoll_l.def	wcsncasecmp_l.def wcsxfrm_l.def \
-strverscmp.def	strnstr.def
+strverscmp.def	strnstr.def	wmempcpy.def
 
 CHAPTERS = strings.tex wcstrings.tex
diff --git a/newlib/libc/string/Makefile.in b/newlib/libc/string/Makefile.in
index 13dee83..a73d2fe 100644
--- a/newlib/libc/string/Makefile.in
+++ b/newlib/libc/string/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.12.2 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2012 Free Software Foundation, Inc.
-
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -53,11 +54,15 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 DIST_COMMON = $(srcdir)/../../Makefile.shared $(srcdir)/Makefile.in \
-	$(srcdir)/Makefile.am $(top_srcdir)/../../mkinstalldirs
+	$(srcdir)/Makefile.am
 subdir = string
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../acinclude.m4 \
-	$(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+	$(top_srcdir)/../../ltoptions.m4 \
+	$(top_srcdir)/../../ltsugar.m4 \
+	$(top_srcdir)/../../ltversion.m4 \
+	$(top_srcdir)/../../lt~obsolete.m4 \
+	$(top_srcdir)/../acinclude.m4 $(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
@@ -132,7 +137,8 @@ am__objects_1 = lib_a-bcopy.$(OBJEXT) lib_a-bzero.$(OBJEXT) \
 @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@	lib_a-wcscoll_l.$(OBJEXT) \
 @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@	lib_a-wcsncasecmp.$(OBJEXT) \
 @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@	lib_a-wcsncasecmp_l.$(OBJEXT) \
-@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@	lib_a-wcsxfrm_l.$(OBJEXT)
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@	lib_a-wcsxfrm_l.$(OBJEXT) \
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@	lib_a-wmempcpy.$(OBJEXT)
 @USE_LIBTOOL_FALSE@am_lib_a_OBJECTS = $(am__objects_1) \
 @USE_LIBTOOL_FALSE@	$(am__objects_2) $(am__objects_3)
 lib_a_OBJECTS = $(am_lib_a_OBJECTS)
@@ -171,7 +177,8 @@ am__objects_4 = bcopy.lo bzero.lo explicit_bzero.lo ffsl.lo ffsll.lo \
 @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@	wcscoll_l.lo \
 @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@	wcsncasecmp.lo \
 @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@	wcsncasecmp_l.lo \
-@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@	wcsxfrm_l.lo
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@	wcsxfrm_l.lo \
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@	wmempcpy.lo
 @USE_LIBTOOL_TRUE@am_libstring_la_OBJECTS = $(am__objects_4) \
 @USE_LIBTOOL_TRUE@	$(am__objects_5) $(am__objects_6)
 libstring_la_OBJECTS = $(am_libstring_la_OBJECTS)
@@ -258,10 +265,8 @@ LIBTOOL = @LIBTOOL@
 LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
-LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 NEWLIB_CFLAGS = @NEWLIB_CFLAGS@
 NM = @NM@
@@ -290,7 +295,6 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 aext = @aext@
@@ -458,7 +462,8 @@ GENERAL_SOURCES = \
 @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@	wcscoll_l.c \
 @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@	wcsncasecmp.c \
 @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@	wcsncasecmp_l.c \
-@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@	wcsxfrm_l.c
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@	wcsxfrm_l.c \
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@	wmempcpy.c
 
 @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_TRUE@ELIX_4_SOURCES = 
 @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_TRUE@ELIX_4_SOURCES = 
@@ -500,7 +505,7 @@ wmemcmp.def	wmemcpy.def	wmemmove.def	wmemset.def \
 memmem.def	memrchr.def	rawmemchr.def	strchrnul.def \
 strcasecmp_l.def strcoll_l.def	strncasecmp_l.def strxfrm_l.def \
 wcscasecmp_l.def wcscoll_l.def	wcsncasecmp_l.def wcsxfrm_l.def \
-strverscmp.def	strnstr.def
+strverscmp.def	strnstr.def	wmempcpy.def
 
 CHAPTERS = strings.tex wcstrings.tex
 all: all-am
@@ -548,14 +553,12 @@ lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) $(EXTRA_lib_a_DEPENDENCIES)
 
 clean-noinstLTLIBRARIES:
 	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
-	@list='$(noinst_LTLIBRARIES)'; \
-	locs=`for p in $$list; do echo $$p; done | \
-	      sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
-	      sort -u`; \
-	test -z "$$locs" || { \
-	  echo rm -f $${locs}; \
-	  rm -f $${locs}; \
-	}
+	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
 libstring.la: $(libstring_la_OBJECTS) $(libstring_la_DEPENDENCIES) $(EXTRA_libstring_la_DEPENDENCIES) 
 	$(libstring_la_LINK) $(am_libstring_la_rpath) $(libstring_la_OBJECTS) $(libstring_la_LIBADD) $(LIBS)
 
@@ -1198,6 +1201,12 @@ lib_a-wcsxfrm_l.o: wcsxfrm_l.c
 lib_a-wcsxfrm_l.obj: wcsxfrm_l.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wcsxfrm_l.obj `if test -f 'wcsxfrm_l.c'; then $(CYGPATH_W) 'wcsxfrm_l.c'; else $(CYGPATH_W) '$(srcdir)/wcsxfrm_l.c'; fi`
 
+lib_a-wmempcpy.o: wmempcpy.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wmempcpy.o `test -f 'wmempcpy.c' || echo '$(srcdir)/'`wmempcpy.c
+
+lib_a-wmempcpy.obj: wmempcpy.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wmempcpy.obj `if test -f 'wmempcpy.c'; then $(CYGPATH_W) 'wmempcpy.c'; else $(CYGPATH_W) '$(srcdir)/wmempcpy.c'; fi`
+
 mostlyclean-libtool:
 	-rm -f *.lo
 
@@ -1253,20 +1262,6 @@ GTAGS:
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
 
-cscopelist:  $(HEADERS) $(SOURCES) $(LISP)
-	list='$(SOURCES) $(HEADERS) $(LISP)'; \
-	case "$(srcdir)" in \
-	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
-	  *) sdir=$(subdir)/$(srcdir) ;; \
-	esac; \
-	for i in $$list; do \
-	  if test -f "$$i"; then \
-	    echo "$(subdir)/$$i"; \
-	  else \
-	    echo "$$sdir/$$i"; \
-	  fi; \
-	done >> $(top_builddir)/cscope.files
-
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 check-am:
@@ -1377,7 +1372,7 @@ uninstall-am:
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
 	clean-libtool clean-noinstLIBRARIES clean-noinstLTLIBRARIES \
-	cscopelist ctags distclean distclean-compile distclean-generic \
+	ctags distclean distclean-compile distclean-generic \
 	distclean-libtool distclean-tags dvi dvi-am html html-am info \
 	info-am install install-am install-data install-data-am \
 	install-dvi install-dvi-am install-exec install-exec-am \
diff --git a/newlib/libc/string/wcstrings.tex b/newlib/libc/string/wcstrings.tex
index 5b9c220..161b35c 100644
--- a/newlib/libc/string/wcstrings.tex
+++ b/newlib/libc/string/wcstrings.tex
@@ -10,6 +10,7 @@ declarations are in @file{wchar.h}.
 * wmemcmp::     Compare two wide-character memory areas
 * wmemcpy::     Copy wide-character memory regions
 * wmemmove::    Move possibly overlapping wide-character memory
+* wmempcpy::    Copy wide-character memory regions and locate end
 * wmemset::     Set an area of memory to a specified wide character
 * wcscat::      Concatenate wide-character strings
 * wcschr::      Search for wide character in string
@@ -50,6 +51,9 @@ declarations are in @file{wchar.h}.
 @include string/wmemmove.def
 
 @page
+@include string/wmempcpy.def
+
+@page
 @include string/wmemset.def
 
 @page
diff --git a/newlib/libc/string/wmempcpy.c b/newlib/libc/string/wmempcpy.c
new file mode 100644
index 0000000..a3b2ce6
--- /dev/null
+++ b/newlib/libc/string/wmempcpy.c
@@ -0,0 +1,43 @@
+/*
+FUNCTION
+	<<wmempcpy>>---copy wide characters in memory and return end pointer
+
+SYNOPSIS
+	#define _GNU_SOURCE
+	#include <wchar.h>
+	wchar_t *wmempcpy(wchar_t *<[d]>,
+			 const wchar_t *<[s]>, size_t <[n]>);
+
+DESCRIPTION
+	The <<wmemcpy>> function copies <[n]> wide characters from the object
+	pointed to by <[s]> to the object pointed to be <[d]>. This function
+	is not affected by locale and all wchar_t values are treated
+	identically.  The null wide character and wchar_t values not
+	corresponding to valid characters are not treated specially.
+
+	If <[n]> is zero, <[d]> and <[s]> must be a valid pointers, and the
+	function copies zero wide characters.
+
+RETURNS
+	<<wmempcpy>> returns a pointer to the wide character following the
+	last wide character copied to the <[out]> region.
+
+PORTABILITY
+<<wmempcpy>> is a GNU extension.
+
+No supporting OS subroutines are required.
+*/
+
+#define _GNU_SOURCE
+#include <_ansi.h>
+#include <string.h>
+#include <wchar.h>
+
+wchar_t *
+_DEFUN (wmempcpy, (d, s, n),
+	wchar_t *__restrict d _AND
+	_CONST wchar_t *__restrict s _AND
+	size_t n)
+{
+  return (wchar_t *) mempcpy (d, s, n * sizeof (wchar_t));
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]