Browse Source

using new 'lua_newuserdatauv' instead of 'lua_newuserdata'

Roberto Ierusalimschy 7 years ago
parent
commit
c67603fafb
3 changed files with 6 additions and 6 deletions
  1. 2 2
      lauxlib.c
  2. 2 2
      liolib.c
  3. 2 2
      lstrlib.c

+ 2 - 2
lauxlib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lauxlib.c,v 1.291 2017/06/27 18:32:49 roberto Exp roberto $
+** $Id: lauxlib.c,v 1.292 2018/01/29 19:13:27 roberto Exp roberto $
 ** Auxiliary functions for building Lua libraries
 ** See Copyright Notice in lua.h
 */
@@ -480,7 +480,7 @@ static int boxgc (lua_State *L) {
 
 
 static void *newbox (lua_State *L, size_t newsize) {
-  UBox *box = (UBox *)lua_newuserdata(L, sizeof(UBox));
+  UBox *box = (UBox *)lua_newuserdatauv(L, sizeof(UBox), 0);
   box->box = NULL;
   box->bsize = 0;
   if (luaL_newmetatable(L, "_UBOX*")) {  /* creating metatable? */

+ 2 - 2
liolib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: liolib.c,v 2.153 2017/11/16 13:19:06 roberto Exp roberto $
+** $Id: liolib.c,v 2.154 2017/11/16 16:28:36 roberto Exp roberto $
 ** Standard I/O (and system) library
 ** See Copyright Notice in lua.h
 */
@@ -186,7 +186,7 @@ static FILE *tofile (lua_State *L) {
 ** handle is in a consistent state.
 */
 static LStream *newprefile (lua_State *L) {
-  LStream *p = (LStream *)lua_newuserdata(L, sizeof(LStream));
+  LStream *p = (LStream *)lua_newuserdatauv(L, sizeof(LStream), 0);
   p->closef = NULL;  /* mark file handle as 'closed' */
   luaL_setmetatable(L, LUA_FILEHANDLE);
   return p;

+ 2 - 2
lstrlib.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lstrlib.c,v 1.259 2017/11/16 13:19:06 roberto Exp roberto $
+** $Id: lstrlib.c,v 1.260 2017/11/23 19:29:04 roberto Exp roberto $
 ** Standard library for string operations and pattern-matching
 ** See Copyright Notice in lua.h
 */
@@ -837,7 +837,7 @@ static int gmatch (lua_State *L) {
   const char *p = luaL_checklstring(L, 2, &lp);
   GMatchState *gm;
   lua_settop(L, 2);  /* keep them on closure to avoid being collected */
-  gm = (GMatchState *)lua_newuserdata(L, sizeof(GMatchState));
+  gm = (GMatchState *)lua_newuserdatauv(L, sizeof(GMatchState), 0);
   prepstate(&gm->ms, L, s, ls, p, lp);
   gm->src = s; gm->p = p; gm->lastmatch = NULL;
   lua_pushcclosure(L, gmatch_aux, 3);