scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

xstrdup.c (218B)


      1 /* See LICENSE file for copyright and license details. */
      2 #include <string.h>
      3 #include "../inc/cc.h"
      4 
      5 char *
      6 xstrdup(const char *s)
      7 {
      8 	size_t len = strlen(s) + 1;
      9 	char *p = xmalloc(len);
     10 
     11 	return memcpy(p, s, len);
     12 }