strdup is done via mem.c to control its memory allocation

This commit is contained in:
Roberto Ierusalimschy
1995-01-14 13:40:26 -02:00
parent 8faf4d1de2
commit f4591397da
5 changed files with 18 additions and 9 deletions

View File

@@ -3,7 +3,7 @@
** TecCGraf - PUC-Rio
*/
char *rcs_mem = "$Id: mem.c,v 1.2 1994/11/16 18:09:11 roberto Stab $";
char *rcs_mem = "$Id: mem.c,v 1.3 1994/12/20 21:20:36 roberto Exp roberto $";
#include <stdlib.h>
@@ -34,3 +34,10 @@ void *luaI_realloc (void *oldblock, unsigned long size)
return block;
}
char *luaI_strdup (char *str)
{
char *newstr = luaI_malloc(strlen(str)+1);
strcpy(newstr, str);
return newstr;
}