From f4591397da8444d1917a67a34cb6a6ac8137385e Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Sat, 14 Jan 1995 13:40:26 -0200 Subject: strdup is done via mem.c to control its memory allocation --- luamem.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'luamem.c') diff --git a/luamem.c b/luamem.c index 8c3582c5..a970712e 100644 --- a/luamem.c +++ b/luamem.c @@ -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 @@ -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; +} -- cgit v1.2.3-55-g6feb