diff options
Diffstat (limited to 'lstring.c')
-rw-r--r-- | lstring.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstring.c,v 2.38 2014/03/19 18:51:42 roberto Exp roberto $ | 2 | ** $Id: lstring.c,v 2.39 2014/04/02 16:44:42 roberto Exp roberto $ |
3 | ** String table (keeps all strings handled by Lua) | 3 | ** String table (keeps all strings handled by Lua) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -90,9 +90,11 @@ void luaS_resize (lua_State *L, int newsize) { | |||
90 | static TString *createstrobj (lua_State *L, const char *str, size_t l, | 90 | static TString *createstrobj (lua_State *L, const char *str, size_t l, |
91 | int tag, unsigned int h) { | 91 | int tag, unsigned int h) { |
92 | TString *ts; | 92 | TString *ts; |
93 | GCObject *o; | ||
93 | size_t totalsize; /* total size of TString object */ | 94 | size_t totalsize; /* total size of TString object */ |
94 | totalsize = sizeof(TString) + ((l + 1) * sizeof(char)); | 95 | totalsize = sizeof(TString) + ((l + 1) * sizeof(char)); |
95 | ts = &luaC_newobj(L, tag, totalsize)->ts; | 96 | o = luaC_newobj(L, tag, totalsize); |
97 | ts = rawgco2ts(o); | ||
96 | ts->tsv.len = l; | 98 | ts->tsv.len = l; |
97 | ts->tsv.hash = h; | 99 | ts->tsv.hash = h; |
98 | ts->tsv.extra = 0; | 100 | ts->tsv.extra = 0; |
@@ -165,9 +167,11 @@ TString *luaS_new (lua_State *L, const char *str) { | |||
165 | 167 | ||
166 | Udata *luaS_newudata (lua_State *L, size_t s) { | 168 | Udata *luaS_newudata (lua_State *L, size_t s) { |
167 | Udata *u; | 169 | Udata *u; |
170 | GCObject *o; | ||
168 | if (s > MAX_SIZE - sizeof(Udata)) | 171 | if (s > MAX_SIZE - sizeof(Udata)) |
169 | luaM_toobig(L); | 172 | luaM_toobig(L); |
170 | u = &luaC_newobj(L, LUA_TUSERDATA, sizeof(Udata) + s)->u; | 173 | o = luaC_newobj(L, LUA_TUSERDATA, sizeof(Udata) + s); |
174 | u = rawgco2u(o); | ||
171 | u->uv.len = s; | 175 | u->uv.len = s; |
172 | u->uv.metatable = NULL; | 176 | u->uv.metatable = NULL; |
173 | setuservalue(L, u, luaO_nilobject); | 177 | setuservalue(L, u, luaO_nilobject); |