One Level Up
Top Level
src/lj_udata.c - luajit-2.0-src
Functions defined
Macros defined
Source code
- #define lj_udata_c
- #define LUA_CORE
- #include "lj_obj.h"
- #include "lj_gc.h"
- #include "lj_udata.h"
- GCudata *lj_udata_new(lua_State *L, MSize sz, GCtab *env)
- {
- GCudata *ud = lj_mem_newt(L, sizeof(GCudata) + sz, GCudata);
- global_State *g = G(L);
- newwhite(g, ud);
- ud->gct = ~LJ_TUDATA;
- ud->udtype = UDTYPE_USERDATA;
- ud->len = sz;
-
- setgcrefnull(ud->metatable);
- setgcref(ud->env, obj2gco(env));
-
- setgcrefr(ud->nextgc, mainthread(g)->nextgc);
- setgcref(mainthread(g)->nextgc, obj2gco(ud));
- return ud;
- }
- void LJ_FASTCALL lj_udata_free(global_State *g, GCudata *ud)
- {
- lj_mem_free(g, ud, sizeudata(ud));
- }
One Level Up
Top Level