Back to index

cell-binutils  2.17cvs20070401
xstrndup.c File Reference
#include <sys/types.h>
#include "ansidecl.h"
#include "libiberty.h"

Go to the source code of this file.


char * xstrndup (const char *s, size_t n)

Function Documentation

char* xstrndup ( const char *  s,
size_t  n 

Definition at line 48 of file xstrndup.c.

  char *result;
  size_t len = strlen (s);

  if (n < len)
    len = n;

  result = XNEWVEC (char, len + 1);

  result[len] = '\0';
  return (char *) memcpy (result, s, len);

Here is the call graph for this function: