copy(), allow NULL argument

This commit is contained in:
rlar 2012-07-28 19:53:55 +02:00
parent b808fcec8a
commit 608e0473d3
1 changed files with 3 additions and 0 deletions

View File

@ -28,6 +28,9 @@ copy(const char *str)
{
char *p;
if (!str)
return NULL;
if ((p = TMALLOC(char, strlen(str) + 1)) != NULL)
(void) strcpy(p, str);
return(p);