浏览代码

reserve one more bit for GC

Roberto Ierusalimschy 23 年之前
父节点
当前提交
5023aaee0a
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      lstring.c

+ 2 - 2
lstring.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lstring.c,v 1.1 2001/11/29 22:14:34 rieru Exp rieru $
+** $Id: lstring.c,v 1.72 2002/02/08 22:41:09 roberto Exp roberto $
 ** String table (keeps all strings handled by Lua)
 ** See Copyright Notice in lua.h
 */
@@ -85,7 +85,7 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
 
 Udata *luaS_newudata (lua_State *L, size_t s) {
   Udata *u;
-  if (s & 1) s++;  /* make sure size is even */
+  s = (s+3) & (~(size_t)3);  /* make sure size is multiple of 4 */
   u = cast(Udata *, luaM_malloc(L, sizeudata(s)));
   u->uv.len = s;
   u->uv.metatable = hvalue(defaultmeta(L));