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

@ -21,8 +21,7 @@
#if defined(LUA_COMPAT_MAXN)
static int maxn(lua_State *L)
{
static int maxn(lua_State *L) {
lua_Number max = 0;
luaL_checktype(L, 1, LUA_TTABLE);
lua_pushnil(L); /* first key */
@ -39,8 +38,7 @@ static int maxn(lua_State *L)
#endif
static int tinsert(lua_State *L)
{
static int tinsert(lua_State *L) {
int e = aux_getn(L, 1) + 1; /* first empty element */
int pos; /* where to insert new element */
switch (lua_gettop(L)) {
@ -67,8 +65,7 @@ static int tinsert(lua_State *L)
}
static int tremove(lua_State *L)
{
static int tremove(lua_State *L) {
int size = aux_getn(L, 1);
int pos = luaL_optint(L, 2, size);
if (pos != size) /* validate 'pos' if given */
@ -84,8 +81,7 @@ static int tremove(lua_State *L)
}
static void addfield(lua_State *L, luaL_Buffer *b, int i)
{
static void addfield(lua_State *L, luaL_Buffer *b, int i) {
lua_rawgeti(L, 1, i);
if (!lua_isstring(L, -1))
luaL_error(L, "invalid value (%s) at index %d in table for "
@ -94,8 +90,7 @@ static void addfield(lua_State *L, luaL_Buffer *b, int i)
}
static int tconcat(lua_State *L)
{
static int tconcat(lua_State *L) {
luaL_Buffer b;
size_t lsep;
int i, last;
@ -121,8 +116,7 @@ static int tconcat(lua_State *L)
** =======================================================
*/
static int pack(lua_State *L)
{
static int pack(lua_State *L) {
int n = lua_gettop(L); /* number of elements to pack */
lua_createtable(L, n, 1); /* create result table */
lua_pushinteger(L, n);
@ -139,8 +133,7 @@ static int pack(lua_State *L)
}
static int unpack(lua_State *L)
{
static int unpack(lua_State *L) {
int i, e, n;
luaL_checktype(L, 1, LUA_TTABLE);
i = luaL_optint(L, 2, 1);
@ -168,14 +161,12 @@ static int unpack(lua_State *L)
*/
static void set2(lua_State *L, int i, int j)
{
static void set2(lua_State *L, int i, int j) {
lua_rawseti(L, 1, i);
lua_rawseti(L, 1, j);
}
static int sort_comp(lua_State *L, int a, int b)
{
static int sort_comp(lua_State *L, int a, int b) {
if (!lua_isnil(L, 2)) { /* function? */
int res;
lua_pushvalue(L, 2);
@ -189,8 +180,7 @@ static int sort_comp(lua_State *L, int a, int b)
return lua_compare(L, a, b, LUA_OPLT);
}
static void auxsort(lua_State *L, int l, int u)
{
static void auxsort(lua_State *L, int l, int u) {
while (l < u) { /* for tail recursion */
int i, j;
/* sort elements a[l], a[(l+u)/2] and a[u] */
@ -257,8 +247,7 @@ static void auxsort(lua_State *L, int l, int u)
} /* repeat the routine for the larger one */
}
static int sort(lua_State *L)
{
static int sort(lua_State *L) {
int n = aux_getn(L, 1);
luaL_checkstack(L, 40, ""); /* assume array is smaller than 2^40 */
if (!lua_isnoneornil(L, 2)) /* is there a 2nd argument? */
@ -285,8 +274,7 @@ static const luaL_Reg tab_funcs[] = {
};
LUAMOD_API int luaopen_table(lua_State *L)
{
LUAMOD_API int luaopen_table(lua_State *L) {
luaL_newlib(L, tab_funcs);
#if defined(LUA_COMPAT_UNPACK)
/* _G.unpack = table.unpack */