Back to index

glibc  2.9
Defines | Functions
wcpcpy_chk.c File Reference
#include <wchar.h>
#include <stddef.h>

Go to the source code of this file.

Defines

#define __need_ptrdiff_t

Functions

wchar_t * __wcpcpy_chk (wchar_t *dest, const wchar_t *src, size_t destlen)

Define Documentation

Definition at line 22 of file wcpcpy_chk.c.


Function Documentation

wchar_t* __wcpcpy_chk ( wchar_t *  dest,
const wchar_t *  src,
size_t  destlen 
)

Definition at line 29 of file wcpcpy_chk.c.

{
  wchar_t *wcp = (wchar_t *) dest - 1;
  wint_t c;
  const ptrdiff_t off = src - dest + 1;

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

  return wcp;
}

Here is the call graph for this function: