diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-07-18 11:46:47 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-07-18 11:46:47 -0300 |
commit | bb129031205acc64eb6b41c98d8a08c1fccce308 (patch) | |
tree | 65e01a5af21d2867c3108507ed0afbb8d32201bd /lstring.c | |
parent | ca41b43f53562e64abe433d6346d174c92548603 (diff) | |
download | lua-bb129031205acc64eb6b41c98d8a08c1fccce308.tar.gz lua-bb129031205acc64eb6b41c98d8a08c1fccce308.tar.bz2 lua-bb129031205acc64eb6b41c98d8a08c1fccce308.zip |
type 'Udata' refers directly to structure inside the union (union
used only for aligning purposes now)
Diffstat (limited to 'lstring.c')
-rw-r--r-- | lstring.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstring.c,v 2.41 2014/07/18 12:17:54 roberto Exp roberto $ | 2 | ** $Id: lstring.c,v 2.42 2014/07/18 13:36:14 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 | */ |
@@ -170,10 +170,10 @@ Udata *luaS_newudata (lua_State *L, size_t s) { | |||
170 | GCObject *o; | 170 | GCObject *o; |
171 | if (s > MAX_SIZE - sizeof(Udata)) | 171 | if (s > MAX_SIZE - sizeof(Udata)) |
172 | luaM_toobig(L); | 172 | luaM_toobig(L); |
173 | o = luaC_newobj(L, LUA_TUSERDATA, sizeof(Udata) + s); | 173 | o = luaC_newobj(L, LUA_TUSERDATA, sizeludata(s)); |
174 | u = rawgco2u(o); | 174 | u = gco2u(o); |
175 | u->uv.len = s; | 175 | u->len = s; |
176 | u->uv.metatable = NULL; | 176 | u->metatable = NULL; |
177 | setuservalue(L, u, luaO_nilobject); | 177 | setuservalue(L, u, luaO_nilobject); |
178 | return u; | 178 | return u; |
179 | } | 179 | } |