]>
diplodocus.org Git - nmh/blob - sbr/getcpy.c
3 * getcpy.c -- copy a string in managed memory
5 * THIS IS OBSOLETE. NEED TO REPLACE ALL OCCURENCES
6 * OF GETCPY WITH STRDUP. BUT THIS WILL REQUIRE
7 * CHANGING PARTS OF THE CODE TO DEAL WITH NULL VALUES.
22 len
= strlen(str
) + 1;
23 if (!(cp
= malloc (len
)))
24 adios (NULL
, "unable to allocate string storage");
25 memcpy (cp
, str
, len
);
27 if (!(cp
= malloc ((size_t) 1)))
28 adios (NULL
, "unable to allocate string storage");