File: wcpcpy.c

package info (click to toggle)
picolibc 1.8.11-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 50,064 kB
  • sloc: ansic: 404,031; asm: 24,984; sh: 2,585; python: 2,289; perl: 680; pascal: 329; exp: 287; makefile: 222; cpp: 71; xml: 40
file content (35 lines) | stat: -rw-r--r-- 952 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Copyright (c) 2007 Corinna Vinschen <corinna@vinschen.de> */
/*
FUNCTION
        <<wcpcpy>>---copy a wide-character string returning a pointer to its end

SYNOPSIS
        #include <wchar.h>
        wchar_t *wcpcpy(wchar_t *<[s1]>, const wchar_t *<[s2]>);

DESCRIPTION
        The <<wcpcpy>> function copies the wide-character string pointed to by
        <[s2]> (including the terminating null wide-character code) into the
        array pointed to by <[s1]>. If copying takes place between objects that
        overlap, the behaviour is undefined.

RETURNS
        This function returns a pointer to the end of the destination string,
        thus pointing to the trailing '\0'.

PORTABILITY
<<wcpcpy>> is a GNU extension.

No supporting OS subroutines are required.
*/

#define _DEFAULT_SOURCE
#include <wchar.h>

wchar_t *
wcpcpy(wchar_t * __restrict s1, const wchar_t * __restrict s2)
{
    while ((*s1++ = *s2++))
        ;
    return --s1;
}