diff options
| -rw-r--r-- | lstring.c | 4 |
1 files changed, 2 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstring.c,v 1.1 2001/11/29 22:14:34 rieru Exp rieru $ | 2 | ** $Id: lstring.c,v 1.72 2002/02/08 22:41:09 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 | */ |
| @@ -85,7 +85,7 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { | |||
| 85 | 85 | ||
| 86 | Udata *luaS_newudata (lua_State *L, size_t s) { | 86 | Udata *luaS_newudata (lua_State *L, size_t s) { |
| 87 | Udata *u; | 87 | Udata *u; |
| 88 | if (s & 1) s++; /* make sure size is even */ | 88 | s = (s+3) & (~(size_t)3); /* make sure size is multiple of 4 */ |
| 89 | u = cast(Udata *, luaM_malloc(L, sizeudata(s))); | 89 | u = cast(Udata *, luaM_malloc(L, sizeudata(s))); |
| 90 | u->uv.len = s; | 90 | u->uv.len = s; |
| 91 | u->uv.metatable = hvalue(defaultmeta(L)); | 91 | u->uv.metatable = hvalue(defaultmeta(L)); |
