copy(), allow NULL argument
This commit is contained in:
parent
b808fcec8a
commit
608e0473d3
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue