URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
[/] [or1k/] [branches/] [stable_0_2_x/] [or1ksim/] [port/] [strndup.c] - Rev 1781
Go to most recent revision | Compare with Previous | Blame | View Log
#include "config.h" #include "port.h" #include <string.h> #if !defined(HAVE_STRNDUP) /* Taken from glibc */ char * strndup (const char *s, size_t n) { char *new; size_t len = strlen (s); if (len>n) len=n; new = (char *) malloc (len + 1); if (new == NULL) return NULL; new[len] = '\0'; return (char *) memcpy (new, s, len); } #endif
Go to most recent revision | Compare with Previous | Blame | View Log