diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-04-05 11:21:38 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-04-05 11:21:38 -0300 |
commit | a2f98314a30859b217d6f7f7741c785a8e029e3c (patch) | |
tree | 04f5ddb62d4dcb0647ff3406c4772580e0c50e6c /lapi.c | |
parent | a09c8d7beb79611a7bc5f2b6f8255cc18b0feef3 (diff) | |
download | lua-a2f98314a30859b217d6f7f7741c785a8e029e3c.tar.gz lua-a2f98314a30859b217d6f7f7741c785a8e029e3c.tar.bz2 lua-a2f98314a30859b217d6f7f7741c785a8e029e3c.zip |
'lua_pushstring' now uses 'luaS_new'
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.118 2010/03/29 17:43:14 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.119 2010/04/02 15:19:19 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -442,8 +442,16 @@ LUA_API const char *lua_pushstring (lua_State *L, const char *s) { | |||
442 | lua_pushnil(L); | 442 | lua_pushnil(L); |
443 | return NULL; | 443 | return NULL; |
444 | } | 444 | } |
445 | else | 445 | else { |
446 | return lua_pushlstring(L, s, strlen(s)); | 446 | TString *ts; |
447 | lua_lock(L); | ||
448 | luaC_checkGC(L); | ||
449 | ts = luaS_new(L, s); | ||
450 | setsvalue2s(L, L->top, ts); | ||
451 | api_incr_top(L); | ||
452 | lua_unlock(L); | ||
453 | return getstr(ts); | ||
454 | } | ||
447 | } | 455 | } |
448 | 456 | ||
449 | 457 | ||