From a2f98314a30859b217d6f7f7741c785a8e029e3c Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 5 Apr 2010 11:21:38 -0300 Subject: 'lua_pushstring' now uses 'luaS_new' --- lapi.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lapi.c') diff --git a/lapi.c b/lapi.c index 7a91185a..0ed2734d 100644 --- a/lapi.c +++ b/lapi.c @@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 2.118 2010/03/29 17:43:14 roberto Exp roberto $ +** $Id: lapi.c,v 2.119 2010/04/02 15:19:19 roberto Exp roberto $ ** Lua API ** See Copyright Notice in lua.h */ @@ -442,8 +442,16 @@ LUA_API const char *lua_pushstring (lua_State *L, const char *s) { lua_pushnil(L); return NULL; } - else - return lua_pushlstring(L, s, strlen(s)); + else { + TString *ts; + lua_lock(L); + luaC_checkGC(L); + ts = luaS_new(L, s); + setsvalue2s(L, L->top, ts); + api_incr_top(L); + lua_unlock(L); + return getstr(ts); + } } -- cgit v1.2.3-55-g6feb