diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-21 10:48:44 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-21 10:48:44 -0300 |
| commit | c67603fafba7f982e92eb870ff4da6c6433c2a85 (patch) | |
| tree | 4f462d90c766a989e4a41d8bf62199554c7792ab | |
| parent | 06865aa01d1a8bfcf9f2f4b5a71e37a2561eeea6 (diff) | |
| download | lua-c67603fafba7f982e92eb870ff4da6c6433c2a85.tar.gz lua-c67603fafba7f982e92eb870ff4da6c6433c2a85.tar.bz2 lua-c67603fafba7f982e92eb870ff4da6c6433c2a85.zip | |
using new 'lua_newuserdatauv' instead of 'lua_newuserdata'
| -rw-r--r-- | lauxlib.c | 4 | ||||
| -rw-r--r-- | liolib.c | 4 | ||||
| -rw-r--r-- | lstrlib.c | 4 |
3 files changed, 6 insertions, 6 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.c,v 1.291 2017/06/27 18:32:49 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.292 2018/01/29 19:13:27 roberto Exp roberto $ |
| 3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -480,7 +480,7 @@ static int boxgc (lua_State *L) { | |||
| 480 | 480 | ||
| 481 | 481 | ||
| 482 | static void *newbox (lua_State *L, size_t newsize) { | 482 | static void *newbox (lua_State *L, size_t newsize) { |
| 483 | UBox *box = (UBox *)lua_newuserdata(L, sizeof(UBox)); | 483 | UBox *box = (UBox *)lua_newuserdatauv(L, sizeof(UBox), 0); |
| 484 | box->box = NULL; | 484 | box->box = NULL; |
| 485 | box->bsize = 0; | 485 | box->bsize = 0; |
| 486 | if (luaL_newmetatable(L, "_UBOX*")) { /* creating metatable? */ | 486 | if (luaL_newmetatable(L, "_UBOX*")) { /* creating metatable? */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: liolib.c,v 2.153 2017/11/16 13:19:06 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.154 2017/11/16 16:28:36 roberto Exp roberto $ |
| 3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -186,7 +186,7 @@ static FILE *tofile (lua_State *L) { | |||
| 186 | ** handle is in a consistent state. | 186 | ** handle is in a consistent state. |
| 187 | */ | 187 | */ |
| 188 | static LStream *newprefile (lua_State *L) { | 188 | static LStream *newprefile (lua_State *L) { |
| 189 | LStream *p = (LStream *)lua_newuserdata(L, sizeof(LStream)); | 189 | LStream *p = (LStream *)lua_newuserdatauv(L, sizeof(LStream), 0); |
| 190 | p->closef = NULL; /* mark file handle as 'closed' */ | 190 | p->closef = NULL; /* mark file handle as 'closed' */ |
| 191 | luaL_setmetatable(L, LUA_FILEHANDLE); | 191 | luaL_setmetatable(L, LUA_FILEHANDLE); |
| 192 | return p; | 192 | return p; |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstrlib.c,v 1.259 2017/11/16 13:19:06 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.260 2017/11/23 19:29:04 roberto Exp roberto $ |
| 3 | ** Standard library for string operations and pattern-matching | 3 | ** Standard library for string operations and pattern-matching |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -837,7 +837,7 @@ static int gmatch (lua_State *L) { | |||
| 837 | const char *p = luaL_checklstring(L, 2, &lp); | 837 | const char *p = luaL_checklstring(L, 2, &lp); |
| 838 | GMatchState *gm; | 838 | GMatchState *gm; |
| 839 | lua_settop(L, 2); /* keep them on closure to avoid being collected */ | 839 | lua_settop(L, 2); /* keep them on closure to avoid being collected */ |
| 840 | gm = (GMatchState *)lua_newuserdata(L, sizeof(GMatchState)); | 840 | gm = (GMatchState *)lua_newuserdatauv(L, sizeof(GMatchState), 0); |
| 841 | prepstate(&gm->ms, L, s, ls, p, lp); | 841 | prepstate(&gm->ms, L, s, ls, p, lp); |
| 842 | gm->src = s; gm->p = p; gm->lastmatch = NULL; | 842 | gm->src = s; gm->p = p; gm->lastmatch = NULL; |
| 843 | lua_pushcclosure(L, gmatch_aux, 3); | 843 | lua_pushcclosure(L, gmatch_aux, 3); |
