gcc/libiberty/strdup.c

11 lines
172 B
C
Raw Normal View History

1997-08-22 06:57:35 +08:00
char *
strdup(s)
char *s;
{
char *result = (char*)malloc(strlen(s) + 1);
if (result == (char*)0)
return (char*)0;
strcpy(result, s);
return result;
}