From c67603fafba7f982e92eb870ff4da6c6433c2a85 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 21 Feb 2018 10:48:44 -0300 Subject: [PATCH] using new 'lua_newuserdatauv' instead of 'lua_newuserdata' --- lauxlib.c | 4 ++-- liolib.c | 4 ++-- lstrlib.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lauxlib.c b/lauxlib.c index 09d89d80..febd3eb1 100644 --- a/lauxlib.c +++ b/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? */ diff --git a/liolib.c b/liolib.c index f3c914d7..7dc1dab9 100644 --- a/liolib.c +++ b/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; diff --git a/lstrlib.c b/lstrlib.c index 84b6e4eb..da9ef911 100644 --- a/lstrlib.c +++ b/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);