commit f80ff7a336bc604feb410be691350c19edb3f00e
parent a08fc34ee4f17f9a66bbb96b1cb2dcde00c7e179
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Sat, 3 Apr 2010 17:23:54 -0300
'luaS_new' changed from macro to function
Diffstat:
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/lstring.c b/lstring.c
@@ -1,5 +1,5 @@
/*
-** $Id: lstring.c,v 2.15 2009/12/11 21:31:14 roberto Exp roberto $
+** $Id: lstring.c,v 2.16 2009/12/16 16:42:58 roberto Exp roberto $
** String table (keeps all strings handled by Lua)
** See Copyright Notice in lua.h
*/
@@ -94,6 +94,11 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
}
+TString *luaS_new (lua_State *L, const char *str) {
+ return luaS_newlstr(L, str, strlen(str));
+}
+
+
Udata *luaS_newudata (lua_State *L, size_t s, Table *e) {
Udata *u;
if (s > MAX_SIZET - sizeof(Udata))
diff --git a/lstring.h b/lstring.h
@@ -1,5 +1,5 @@
/*
-** $Id: lstring.h,v 1.43 2005/04/25 19:24:10 roberto Exp roberto $
+** $Id: lstring.h,v 1.44 2010/03/13 15:55:01 roberto Exp roberto $
** String table (keep all strings handled by Lua)
** See Copyright Notice in lua.h
*/
@@ -7,8 +7,6 @@
#ifndef lstring_h
#define lstring_h
-#include <string.h>
-
#include "lgc.h"
#include "lobject.h"
#include "lstate.h"
@@ -18,7 +16,6 @@
#define sizeudata(u) (sizeof(union Udata)+(u)->len)
-#define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s)))
#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \
(sizeof(s)/sizeof(char))-1))
@@ -27,6 +24,7 @@
LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e);
LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
+LUAI_FUNC TString *luaS_new (lua_State *L, const char *str);
#endif