changing {} style to match majority of previous style

This commit is contained in:
Philippe Teuwen 2019-03-10 11:20:22 +01:00
commit 961d929f4d
320 changed files with 5502 additions and 10485 deletions

View file

@ -52,8 +52,7 @@ const char lua_ident[] =
api_check(L, isstackindex(i, o), "index not in the stack")
static TValue *index2addr(lua_State *L, int idx)
{
static TValue *index2addr(lua_State *L, int idx) {
CallInfo *ci = L->ci;
if (idx > 0) {
TValue *o = ci->func + idx;
@ -82,15 +81,13 @@ static TValue *index2addr(lua_State *L, int idx)
** to be called by 'lua_checkstack' in protected mode, to grow stack
** capturing memory errors
*/
static void growstack(lua_State *L, void *ud)
{
static void growstack(lua_State *L, void *ud) {
int size = *(int *)ud;
luaD_growstack(L, size);
}
LUA_API int lua_checkstack(lua_State *L, int size)
{
LUA_API int lua_checkstack(lua_State *L, int size) {
int res;
CallInfo *ci = L->ci;
lua_lock(L);
@ -110,8 +107,7 @@ LUA_API int lua_checkstack(lua_State *L, int size)
}
LUA_API void lua_xmove(lua_State *from, lua_State *to, int n)
{
LUA_API void lua_xmove(lua_State *from, lua_State *to, int n) {
int i;
if (from == to) return;
lua_lock(to);
@ -126,8 +122,7 @@ LUA_API void lua_xmove(lua_State *from, lua_State *to, int n)
}
LUA_API lua_CFunction lua_atpanic(lua_State *L, lua_CFunction panicf)
{
LUA_API lua_CFunction lua_atpanic(lua_State *L, lua_CFunction panicf) {
lua_CFunction old;
lua_lock(L);
old = G(L)->panic;
@ -137,8 +132,7 @@ LUA_API lua_CFunction lua_atpanic(lua_State *L, lua_CFunction panicf)
}
LUA_API const lua_Number *lua_version(lua_State *L)
{
LUA_API const lua_Number *lua_version(lua_State *L) {
static const lua_Number version = LUA_VERSION_NUM;
if (L == NULL) return &version;
else return G(L)->version;
@ -154,22 +148,19 @@ LUA_API const lua_Number *lua_version(lua_State *L)
/*
** convert an acceptable stack index into an absolute index
*/
LUA_API int lua_absindex(lua_State *L, int idx)
{
LUA_API int lua_absindex(lua_State *L, int idx) {
return (idx > 0 || ispseudo(idx))
? idx
: cast_int(L->top - L->ci->func + idx);
}
LUA_API int lua_gettop(lua_State *L)
{
LUA_API int lua_gettop(lua_State *L) {
return cast_int(L->top - (L->ci->func + 1));
}
LUA_API void lua_settop(lua_State *L, int idx)
{
LUA_API void lua_settop(lua_State *L, int idx) {
StkId func = L->ci->func;
lua_lock(L);
if (idx >= 0) {
@ -185,8 +176,7 @@ LUA_API void lua_settop(lua_State *L, int idx)
}
LUA_API void lua_remove(lua_State *L, int idx)
{
LUA_API void lua_remove(lua_State *L, int idx) {
StkId p;
lua_lock(L);
p = index2addr(L, idx);
@ -197,8 +187,7 @@ LUA_API void lua_remove(lua_State *L, int idx)
}
LUA_API void lua_insert(lua_State *L, int idx)
{
LUA_API void lua_insert(lua_State *L, int idx) {
StkId p;
StkId q;
lua_lock(L);
@ -211,8 +200,7 @@ LUA_API void lua_insert(lua_State *L, int idx)
}
static void moveto(lua_State *L, TValue *fr, int idx)
{
static void moveto(lua_State *L, TValue *fr, int idx) {
TValue *to = index2addr(L, idx);
api_checkvalidindex(L, to);
setobj(L, to, fr);
@ -223,8 +211,7 @@ static void moveto(lua_State *L, TValue *fr, int idx)
}
LUA_API void lua_replace(lua_State *L, int idx)
{
LUA_API void lua_replace(lua_State *L, int idx) {
lua_lock(L);
api_checknelems(L, 1);
moveto(L, L->top - 1, idx);
@ -233,8 +220,7 @@ LUA_API void lua_replace(lua_State *L, int idx)
}
LUA_API void lua_copy(lua_State *L, int fromidx, int toidx)
{
LUA_API void lua_copy(lua_State *L, int fromidx, int toidx) {
TValue *fr;
lua_lock(L);
fr = index2addr(L, fromidx);
@ -243,8 +229,7 @@ LUA_API void lua_copy(lua_State *L, int fromidx, int toidx)
}
LUA_API void lua_pushvalue(lua_State *L, int idx)
{
LUA_API void lua_pushvalue(lua_State *L, int idx) {
lua_lock(L);
setobj2s(L, L->top, index2addr(L, idx));
api_incr_top(L);
@ -258,59 +243,51 @@ LUA_API void lua_pushvalue(lua_State *L, int idx)
*/
LUA_API int lua_type(lua_State *L, int idx)
{
LUA_API int lua_type(lua_State *L, int idx) {
StkId o = index2addr(L, idx);
return (isvalid(o) ? ttypenv(o) : LUA_TNONE);
}
LUA_API const char *lua_typename(lua_State *L, int t)
{
LUA_API const char *lua_typename(lua_State *L, int t) {
UNUSED(L);
return ttypename(t);
}
LUA_API int lua_iscfunction(lua_State *L, int idx)
{
LUA_API int lua_iscfunction(lua_State *L, int idx) {
StkId o = index2addr(L, idx);
return (ttislcf(o) || (ttisCclosure(o)));
}
LUA_API int lua_isnumber(lua_State *L, int idx)
{
LUA_API int lua_isnumber(lua_State *L, int idx) {
TValue n;
const TValue *o = index2addr(L, idx);
return tonumber(o, &n);
}
LUA_API int lua_isstring(lua_State *L, int idx)
{
LUA_API int lua_isstring(lua_State *L, int idx) {
int t = lua_type(L, idx);
return (t == LUA_TSTRING || t == LUA_TNUMBER);
}
LUA_API int lua_isuserdata(lua_State *L, int idx)
{
LUA_API int lua_isuserdata(lua_State *L, int idx) {
const TValue *o = index2addr(L, idx);
return (ttisuserdata(o) || ttislightuserdata(o));
}
LUA_API int lua_rawequal(lua_State *L, int index1, int index2)
{
LUA_API int lua_rawequal(lua_State *L, int index1, int index2) {
StkId o1 = index2addr(L, index1);
StkId o2 = index2addr(L, index2);
return (isvalid(o1) && isvalid(o2)) ? luaV_rawequalobj(o1, o2) : 0;
}
LUA_API void lua_arith(lua_State *L, int op)
{
LUA_API void lua_arith(lua_State *L, int op) {
StkId o1; /* 1st operand */
StkId o2; /* 2nd operand */
lua_lock(L);
@ -332,8 +309,7 @@ LUA_API void lua_arith(lua_State *L, int op)
}
LUA_API int lua_compare(lua_State *L, int index1, int index2, int op)
{
LUA_API int lua_compare(lua_State *L, int index1, int index2, int op) {
StkId o1, o2;
int i = 0;
lua_lock(L); /* may call tag method */
@ -359,8 +335,7 @@ LUA_API int lua_compare(lua_State *L, int index1, int index2, int op)
}
LUA_API lua_Number lua_tonumberx(lua_State *L, int idx, int *isnum)
{
LUA_API lua_Number lua_tonumberx(lua_State *L, int idx, int *isnum) {
TValue n;
const TValue *o = index2addr(L, idx);
if (tonumber(o, &n)) {
@ -373,8 +348,7 @@ LUA_API lua_Number lua_tonumberx(lua_State *L, int idx, int *isnum)
}
LUA_API lua_Integer lua_tointegerx(lua_State *L, int idx, int *isnum)
{
LUA_API lua_Integer lua_tointegerx(lua_State *L, int idx, int *isnum) {
TValue n;
const TValue *o = index2addr(L, idx);
if (tonumber(o, &n)) {
@ -390,8 +364,7 @@ LUA_API lua_Integer lua_tointegerx(lua_State *L, int idx, int *isnum)
}
LUA_API lua_Unsigned lua_tounsignedx(lua_State *L, int idx, int *isnum)
{
LUA_API lua_Unsigned lua_tounsignedx(lua_State *L, int idx, int *isnum) {
TValue n;
const TValue *o = index2addr(L, idx);
if (tonumber(o, &n)) {
@ -407,15 +380,13 @@ LUA_API lua_Unsigned lua_tounsignedx(lua_State *L, int idx, int *isnum)
}
LUA_API int lua_toboolean(lua_State *L, int idx)
{
LUA_API int lua_toboolean(lua_State *L, int idx) {
const TValue *o = index2addr(L, idx);
return !l_isfalse(o);
}
LUA_API const char *lua_tolstring(lua_State *L, int idx, size_t *len)
{
LUA_API const char *lua_tolstring(lua_State *L, int idx, size_t *len) {
StkId o = index2addr(L, idx);
if (!ttisstring(o)) {
lua_lock(L); /* `luaV_tostring' may create a new string */
@ -433,8 +404,7 @@ LUA_API const char *lua_tolstring(lua_State *L, int idx, size_t *len)
}
LUA_API size_t lua_rawlen(lua_State *L, int idx)
{
LUA_API size_t lua_rawlen(lua_State *L, int idx) {
StkId o = index2addr(L, idx);
switch (ttypenv(o)) {
case LUA_TSTRING:
@ -449,8 +419,7 @@ LUA_API size_t lua_rawlen(lua_State *L, int idx)
}
LUA_API lua_CFunction lua_tocfunction(lua_State *L, int idx)
{
LUA_API lua_CFunction lua_tocfunction(lua_State *L, int idx) {
StkId o = index2addr(L, idx);
if (ttislcf(o)) return fvalue(o);
else if (ttisCclosure(o))
@ -459,8 +428,7 @@ LUA_API lua_CFunction lua_tocfunction(lua_State *L, int idx)
}
LUA_API void *lua_touserdata(lua_State *L, int idx)
{
LUA_API void *lua_touserdata(lua_State *L, int idx) {
StkId o = index2addr(L, idx);
switch (ttypenv(o)) {
case LUA_TUSERDATA:
@ -473,15 +441,13 @@ LUA_API void *lua_touserdata(lua_State *L, int idx)
}
LUA_API lua_State *lua_tothread(lua_State *L, int idx)
{
LUA_API lua_State *lua_tothread(lua_State *L, int idx) {
StkId o = index2addr(L, idx);
return (!ttisthread(o)) ? NULL : thvalue(o);
}
LUA_API const void *lua_topointer(lua_State *L, int idx)
{
LUA_API const void *lua_topointer(lua_State *L, int idx) {
StkId o = index2addr(L, idx);
switch (ttype(o)) {
case LUA_TTABLE:
@ -509,8 +475,7 @@ LUA_API const void *lua_topointer(lua_State *L, int idx)
*/
LUA_API void lua_pushnil(lua_State *L)
{
LUA_API void lua_pushnil(lua_State *L) {
lua_lock(L);
setnilvalue(L->top);
api_incr_top(L);
@ -518,8 +483,7 @@ LUA_API void lua_pushnil(lua_State *L)
}
LUA_API void lua_pushnumber(lua_State *L, lua_Number n)
{
LUA_API void lua_pushnumber(lua_State *L, lua_Number n) {
lua_lock(L);
setnvalue(L->top, n);
luai_checknum(L, L->top,
@ -529,8 +493,7 @@ LUA_API void lua_pushnumber(lua_State *L, lua_Number n)
}
LUA_API void lua_pushinteger(lua_State *L, lua_Integer n)
{
LUA_API void lua_pushinteger(lua_State *L, lua_Integer n) {
lua_lock(L);
setnvalue(L->top, cast_num(n));
api_incr_top(L);
@ -538,8 +501,7 @@ LUA_API void lua_pushinteger(lua_State *L, lua_Integer n)
}
LUA_API void lua_pushunsigned(lua_State *L, lua_Unsigned u)
{
LUA_API void lua_pushunsigned(lua_State *L, lua_Unsigned u) {
lua_Number n;
lua_lock(L);
n = lua_unsigned2number(u);
@ -549,8 +511,7 @@ LUA_API void lua_pushunsigned(lua_State *L, lua_Unsigned u)
}
LUA_API const char *lua_pushlstring(lua_State *L, const char *s, size_t len)
{
LUA_API const char *lua_pushlstring(lua_State *L, const char *s, size_t len) {
TString *ts;
lua_lock(L);
luaC_checkGC(L);
@ -562,8 +523,7 @@ LUA_API const char *lua_pushlstring(lua_State *L, const char *s, size_t len)
}
LUA_API const char *lua_pushstring(lua_State *L, const char *s)
{
LUA_API const char *lua_pushstring(lua_State *L, const char *s) {
if (s == NULL) {
lua_pushnil(L);
return NULL;
@ -581,8 +541,7 @@ LUA_API const char *lua_pushstring(lua_State *L, const char *s)
LUA_API const char *lua_pushvfstring(lua_State *L, const char *fmt,
va_list argp)
{
va_list argp) {
const char *ret;
lua_lock(L);
luaC_checkGC(L);
@ -592,8 +551,7 @@ LUA_API const char *lua_pushvfstring(lua_State *L, const char *fmt,
}
LUA_API const char *lua_pushfstring(lua_State *L, const char *fmt, ...)
{
LUA_API const char *lua_pushfstring(lua_State *L, const char *fmt, ...) {
const char *ret;
va_list argp;
lua_lock(L);
@ -606,8 +564,7 @@ LUA_API const char *lua_pushfstring(lua_State *L, const char *fmt, ...)
}
LUA_API void lua_pushcclosure(lua_State *L, lua_CFunction fn, int n)
{
LUA_API void lua_pushcclosure(lua_State *L, lua_CFunction fn, int n) {
lua_lock(L);
if (n == 0) {
setfvalue(L->top, fn);
@ -628,8 +585,7 @@ LUA_API void lua_pushcclosure(lua_State *L, lua_CFunction fn, int n)
}
LUA_API void lua_pushboolean(lua_State *L, int b)
{
LUA_API void lua_pushboolean(lua_State *L, int b) {
lua_lock(L);
setbvalue(L->top, (b != 0)); /* ensure that true is 1 */
api_incr_top(L);
@ -637,8 +593,7 @@ LUA_API void lua_pushboolean(lua_State *L, int b)
}
LUA_API void lua_pushlightuserdata(lua_State *L, void *p)
{
LUA_API void lua_pushlightuserdata(lua_State *L, void *p) {
lua_lock(L);
setpvalue(L->top, p);
api_incr_top(L);
@ -646,8 +601,7 @@ LUA_API void lua_pushlightuserdata(lua_State *L, void *p)
}
LUA_API int lua_pushthread(lua_State *L)
{
LUA_API int lua_pushthread(lua_State *L) {
lua_lock(L);
setthvalue(L, L->top, L);
api_incr_top(L);
@ -662,8 +616,7 @@ LUA_API int lua_pushthread(lua_State *L)
*/
LUA_API void lua_getglobal(lua_State *L, const char *var)
{
LUA_API void lua_getglobal(lua_State *L, const char *var) {
Table *reg = hvalue(&G(L)->l_registry);
const TValue *gt; /* global table */
lua_lock(L);
@ -674,8 +627,7 @@ LUA_API void lua_getglobal(lua_State *L, const char *var)
}
LUA_API void lua_gettable(lua_State *L, int idx)
{
LUA_API void lua_gettable(lua_State *L, int idx) {
StkId t;
lua_lock(L);
t = index2addr(L, idx);
@ -684,8 +636,7 @@ LUA_API void lua_gettable(lua_State *L, int idx)
}
LUA_API void lua_getfield(lua_State *L, int idx, const char *k)
{
LUA_API void lua_getfield(lua_State *L, int idx, const char *k) {
StkId t;
lua_lock(L);
t = index2addr(L, idx);
@ -696,8 +647,7 @@ LUA_API void lua_getfield(lua_State *L, int idx, const char *k)
}
LUA_API void lua_rawget(lua_State *L, int idx)
{
LUA_API void lua_rawget(lua_State *L, int idx) {
StkId t;
lua_lock(L);
t = index2addr(L, idx);
@ -707,8 +657,7 @@ LUA_API void lua_rawget(lua_State *L, int idx)
}
LUA_API void lua_rawgeti(lua_State *L, int idx, int n)
{
LUA_API void lua_rawgeti(lua_State *L, int idx, int n) {
StkId t;
lua_lock(L);
t = index2addr(L, idx);
@ -719,8 +668,7 @@ LUA_API void lua_rawgeti(lua_State *L, int idx, int n)
}
LUA_API void lua_rawgetp(lua_State *L, int idx, const void *p)
{
LUA_API void lua_rawgetp(lua_State *L, int idx, const void *p) {
StkId t;
TValue k;
lua_lock(L);
@ -733,8 +681,7 @@ LUA_API void lua_rawgetp(lua_State *L, int idx, const void *p)
}
LUA_API void lua_createtable(lua_State *L, int narray, int nrec)
{
LUA_API void lua_createtable(lua_State *L, int narray, int nrec) {
Table *t;
lua_lock(L);
luaC_checkGC(L);
@ -747,8 +694,7 @@ LUA_API void lua_createtable(lua_State *L, int narray, int nrec)
}
LUA_API int lua_getmetatable(lua_State *L, int objindex)
{
LUA_API int lua_getmetatable(lua_State *L, int objindex) {
const TValue *obj;
Table *mt = NULL;
int res;
@ -777,8 +723,7 @@ LUA_API int lua_getmetatable(lua_State *L, int objindex)
}
LUA_API void lua_getuservalue(lua_State *L, int idx)
{
LUA_API void lua_getuservalue(lua_State *L, int idx) {
StkId o;
lua_lock(L);
o = index2addr(L, idx);
@ -797,8 +742,7 @@ LUA_API void lua_getuservalue(lua_State *L, int idx)
*/
LUA_API void lua_setglobal(lua_State *L, const char *var)
{
LUA_API void lua_setglobal(lua_State *L, const char *var) {
Table *reg = hvalue(&G(L)->l_registry);
const TValue *gt; /* global table */
lua_lock(L);
@ -811,8 +755,7 @@ LUA_API void lua_setglobal(lua_State *L, const char *var)
}
LUA_API void lua_settable(lua_State *L, int idx)
{
LUA_API void lua_settable(lua_State *L, int idx) {
StkId t;
lua_lock(L);
api_checknelems(L, 2);
@ -823,8 +766,7 @@ LUA_API void lua_settable(lua_State *L, int idx)
}
LUA_API void lua_setfield(lua_State *L, int idx, const char *k)
{
LUA_API void lua_setfield(lua_State *L, int idx, const char *k) {
StkId t;
lua_lock(L);
api_checknelems(L, 1);
@ -836,8 +778,7 @@ LUA_API void lua_setfield(lua_State *L, int idx, const char *k)
}
LUA_API void lua_rawset(lua_State *L, int idx)
{
LUA_API void lua_rawset(lua_State *L, int idx) {
StkId t;
lua_lock(L);
api_checknelems(L, 2);
@ -851,8 +792,7 @@ LUA_API void lua_rawset(lua_State *L, int idx)
}
LUA_API void lua_rawseti(lua_State *L, int idx, int n)
{
LUA_API void lua_rawseti(lua_State *L, int idx, int n) {
StkId t;
lua_lock(L);
api_checknelems(L, 1);
@ -865,8 +805,7 @@ LUA_API void lua_rawseti(lua_State *L, int idx, int n)
}
LUA_API void lua_rawsetp(lua_State *L, int idx, const void *p)
{
LUA_API void lua_rawsetp(lua_State *L, int idx, const void *p) {
StkId t;
TValue k;
lua_lock(L);
@ -881,8 +820,7 @@ LUA_API void lua_rawsetp(lua_State *L, int idx, const void *p)
}
LUA_API int lua_setmetatable(lua_State *L, int objindex)
{
LUA_API int lua_setmetatable(lua_State *L, int objindex) {
TValue *obj;
Table *mt;
lua_lock(L);
@ -922,8 +860,7 @@ LUA_API int lua_setmetatable(lua_State *L, int objindex)
}
LUA_API void lua_setuservalue(lua_State *L, int idx)
{
LUA_API void lua_setuservalue(lua_State *L, int idx) {
StkId o;
lua_lock(L);
api_checknelems(L, 1);
@ -951,8 +888,7 @@ LUA_API void lua_setuservalue(lua_State *L, int idx)
"results from function overflow current stack size")
LUA_API int lua_getctx(lua_State *L, int *ctx)
{
LUA_API int lua_getctx(lua_State *L, int *ctx) {
if (L->ci->callstatus & CIST_YIELDED) {
if (ctx) *ctx = L->ci->u.c.ctx;
return L->ci->u.c.status;
@ -961,8 +897,7 @@ LUA_API int lua_getctx(lua_State *L, int *ctx)
LUA_API void lua_callk(lua_State *L, int nargs, int nresults, int ctx,
lua_CFunction k)
{
lua_CFunction k) {
StkId func;
lua_lock(L);
api_check(L, k == NULL || !isLua(L->ci),
@ -992,8 +927,7 @@ struct CallS { /* data to `f_call' */
};
static void f_call(lua_State *L, void *ud)
{
static void f_call(lua_State *L, void *ud) {
struct CallS *c = cast(struct CallS *, ud);
luaD_call(L, c->func, c->nresults, 0);
}
@ -1001,8 +935,7 @@ static void f_call(lua_State *L, void *ud)
LUA_API int lua_pcallk(lua_State *L, int nargs, int nresults, int errfunc,
int ctx, lua_CFunction k)
{
int ctx, lua_CFunction k) {
struct CallS c;
int status;
ptrdiff_t func;
@ -1046,8 +979,7 @@ LUA_API int lua_pcallk(lua_State *L, int nargs, int nresults, int errfunc,
LUA_API int lua_load(lua_State *L, lua_Reader reader, void *data,
const char *chunkname, const char *mode)
{
const char *chunkname, const char *mode) {
ZIO z;
int status;
lua_lock(L);
@ -1070,8 +1002,7 @@ LUA_API int lua_load(lua_State *L, lua_Reader reader, void *data,
}
LUA_API int lua_dump(lua_State *L, lua_Writer writer, void *data)
{
LUA_API int lua_dump(lua_State *L, lua_Writer writer, void *data) {
int status;
TValue *o;
lua_lock(L);
@ -1086,8 +1017,7 @@ LUA_API int lua_dump(lua_State *L, lua_Writer writer, void *data)
}
LUA_API int lua_status(lua_State *L)
{
LUA_API int lua_status(lua_State *L) {
return L->status;
}
@ -1096,8 +1026,7 @@ LUA_API int lua_status(lua_State *L)
** Garbage-collection function
*/
LUA_API int lua_gc(lua_State *L, int what, int data)
{
LUA_API int lua_gc(lua_State *L, int what, int data) {
int res = 0;
global_State *g;
lua_lock(L);
@ -1181,8 +1110,7 @@ LUA_API int lua_gc(lua_State *L, int what, int data)
*/
LUA_API int lua_error(lua_State *L)
{
LUA_API int lua_error(lua_State *L) {
lua_lock(L);
api_checknelems(L, 1);
luaG_errormsg(L);
@ -1191,8 +1119,7 @@ LUA_API int lua_error(lua_State *L)
}
LUA_API int lua_next(lua_State *L, int idx)
{
LUA_API int lua_next(lua_State *L, int idx) {
StkId t;
int more;
lua_lock(L);
@ -1208,8 +1135,7 @@ LUA_API int lua_next(lua_State *L, int idx)
}
LUA_API void lua_concat(lua_State *L, int n)
{
LUA_API void lua_concat(lua_State *L, int n) {
lua_lock(L);
api_checknelems(L, n);
if (n >= 2) {
@ -1224,8 +1150,7 @@ LUA_API void lua_concat(lua_State *L, int n)
}
LUA_API void lua_len(lua_State *L, int idx)
{
LUA_API void lua_len(lua_State *L, int idx) {
StkId t;
lua_lock(L);
t = index2addr(L, idx);
@ -1235,8 +1160,7 @@ LUA_API void lua_len(lua_State *L, int idx)
}
LUA_API lua_Alloc lua_getallocf(lua_State *L, void **ud)
{
LUA_API lua_Alloc lua_getallocf(lua_State *L, void **ud) {
lua_Alloc f;
lua_lock(L);
if (ud) *ud = G(L)->ud;
@ -1246,8 +1170,7 @@ LUA_API lua_Alloc lua_getallocf(lua_State *L, void **ud)
}
LUA_API void lua_setallocf(lua_State *L, lua_Alloc f, void *ud)
{
LUA_API void lua_setallocf(lua_State *L, lua_Alloc f, void *ud) {
lua_lock(L);
G(L)->ud = ud;
G(L)->frealloc = f;
@ -1255,8 +1178,7 @@ LUA_API void lua_setallocf(lua_State *L, lua_Alloc f, void *ud)
}
LUA_API void *lua_newuserdata(lua_State *L, size_t size)
{
LUA_API void *lua_newuserdata(lua_State *L, size_t size) {
Udata *u;
lua_lock(L);
luaC_checkGC(L);
@ -1270,8 +1192,7 @@ LUA_API void *lua_newuserdata(lua_State *L, size_t size)
static const char *aux_upvalue(StkId fi, int n, TValue **val,
GCObject **owner)
{
GCObject **owner) {
switch (ttype(fi)) {
case LUA_TCCL: { /* C closure */
CClosure *f = clCvalue(fi);
@ -1296,8 +1217,7 @@ static const char *aux_upvalue(StkId fi, int n, TValue **val,
}
LUA_API const char *lua_getupvalue(lua_State *L, int funcindex, int n)
{
LUA_API const char *lua_getupvalue(lua_State *L, int funcindex, int n) {
const char *name;
TValue *val = NULL; /* to avoid warnings */
lua_lock(L);
@ -1311,8 +1231,7 @@ LUA_API const char *lua_getupvalue(lua_State *L, int funcindex, int n)
}
LUA_API const char *lua_setupvalue(lua_State *L, int funcindex, int n)
{
LUA_API const char *lua_setupvalue(lua_State *L, int funcindex, int n) {
const char *name;
TValue *val = NULL; /* to avoid warnings */
GCObject *owner = NULL; /* to avoid warnings */
@ -1331,8 +1250,7 @@ LUA_API const char *lua_setupvalue(lua_State *L, int funcindex, int n)
}
static UpVal **getupvalref(lua_State *L, int fidx, int n, LClosure **pf)
{
static UpVal **getupvalref(lua_State *L, int fidx, int n, LClosure **pf) {
LClosure *f;
StkId fi = index2addr(L, fidx);
api_check(L, ttisLclosure(fi), "Lua function expected");
@ -1343,8 +1261,7 @@ static UpVal **getupvalref(lua_State *L, int fidx, int n, LClosure **pf)
}
LUA_API void *lua_upvalueid(lua_State *L, int fidx, int n)
{
LUA_API void *lua_upvalueid(lua_State *L, int fidx, int n) {
StkId fi = index2addr(L, fidx);
switch (ttype(fi)) {
case LUA_TLCL: { /* lua closure */
@ -1364,8 +1281,7 @@ LUA_API void *lua_upvalueid(lua_State *L, int fidx, int n)
LUA_API void lua_upvaluejoin(lua_State *L, int fidx1, int n1,
int fidx2, int n2)
{
int fidx2, int n2) {
LClosure *f1;
UpVal **up1 = getupvalref(L, fidx1, n1, &f1);
UpVal **up2 = getupvalref(L, fidx2, n2, NULL);