Back to index

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

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 25 of file wcscat_chk.c.

{
  register wchar_t *s1 = dest;
  register const wchar_t *s2 = src;
  wchar_t c;

  /* Find the end of the string.  */
  do
    {
      if (__builtin_expect (destlen-- == 0, 0))
       __chk_fail ();
      c = *s1++;
    }
  while (c != L'\0');

  /* Make S1 point before the next character, so we can increment
     it while memory is read (wins on pipelined cpus).  */
  s1 -= 2;
  ++destlen;

  do
    {
      if (__builtin_expect (destlen-- == 0, 0))
       __chk_fail ();
      c = *s2++;
      *++s1 = c;
    }
  while (c != L'\0');

  return dest;
}

Here is the call graph for this function: