Back to index

glibc  2.9
Functions
wcscpy_chk.c File Reference
#include <stddef.h>
#include <wchar.h>

Go to the source code of this file.

Functions

wchar_t * __wcscpy_chk (wchar_t *dest, const wchar_t *src, size_t n)

Function Documentation

wchar_t* __wcscpy_chk ( wchar_t *  dest,
const wchar_t *  src,
size_t  n 
)

Definition at line 26 of file wcscpy_chk.c.

{
  wint_t c;
  wchar_t *wcp;

  if (__alignof__ (wchar_t) >= sizeof (wchar_t))
    {
      const ptrdiff_t off = dest - src - 1;

      wcp = (wchar_t *) src;

      do
       {
         if (__builtin_expect (n-- == 0, 0))
           __chk_fail ();
         c = *wcp++;
         wcp[off] = c;
       }
      while (c != L'\0');
    }
  else
    {
      wcp = dest;

      do
       {
         if (__builtin_expect (n-- == 0, 0))
           __chk_fail ();
         c = *src++;
         *wcp++ = c;
       }
      while (c != L'\0');
    }

  return dest;
}

Here is the call graph for this function: