Skip to content
Snippets Groups Projects
Commit d164c4ec authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Added strdup().

Rev: src/pike_memory.c:1.2
parent 1107924b
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,23 @@ char *xalloc(SIZE_T size)
return 0;
}
/* strdup() is used by several modules, so let's provide it */
#ifndef HAVE_STRDUP
char *strdup(const char *str)
{
char *res = NULL;
if (str) {
int len = strlen(str)+1;
res = xalloc(len);
if (res) {
MEMCPY(res, str, len);
}
}
return(res);
}
#endif /* !HAVE_STRDUP */
void swap(char *a, char *b, INT32 size)
{
int tmp;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment