1 /* Copyright (c) 2017 Yaakov Selkowitz <yselkowi@redhat.com> */
2 /*
3 FUNCTION
4 	<<wmempcpy>>---copy wide characters in memory and return end pointer
5 
6 SYNOPSIS
7 	#define _GNU_SOURCE
8 	#include <wchar.h>
9 	wchar_t *wmempcpy(wchar_t *<[d]>,
10 			 const wchar_t *<[s]>, size_t <[n]>);
11 
12 DESCRIPTION
13 	The <<wmemcpy>> function copies <[n]> wide characters from the object
14 	pointed to by <[s]> to the object pointed to be <[d]>. This function
15 	is not affected by locale and all wchar_t values are treated
16 	identically.  The null wide character and wchar_t values not
17 	corresponding to valid characters are not treated specially.
18 
19 	If <[n]> is zero, <[d]> and <[s]> must be a valid pointers, and the
20 	function copies zero wide characters.
21 
22 RETURNS
23 	<<wmempcpy>> returns a pointer to the wide character following the
24 	last wide character copied to the <[out]> region.
25 
26 PORTABILITY
27 <<wmempcpy>> is a GNU extension.
28 
29 No supporting OS subroutines are required.
30 */
31 
32 #define _GNU_SOURCE
33 #include <_ansi.h>
34 #include <string.h>
35 #include <wchar.h>
36 
37 wchar_t *
wmempcpy(wchar_t * __restrict d,const wchar_t * __restrict s,size_t n)38 wmempcpy (wchar_t *__restrict d,
39 	const wchar_t *__restrict s,
40 	size_t n)
41 {
42   return (wchar_t *) mempcpy (d, s, n * sizeof (wchar_t));
43 }
44