Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Palsson <karlp@etactica.com>2020-06-30 13:38:43 +0300
committerPetr Štetiar <ynezz@true.cz>2020-07-11 12:15:12 +0300
commit53b9a2123fc6f0a7fa09ada066cbb0491c72bcf5 (patch)
tree877bb70ec1c6203df81c1e702a387eb8571f30a0 /lua/uloop.c
parentc0941d3289fc0f1468ad6384f7af141cfd4adead (diff)
lua/uloop: fd_add: use absolute indices for arguments
Instead of having to adjust the index repeatedly as the stack is manipulated, use absolute addressing for the function arguments, so they stay the same throughout the call. Zero functional change, just subjectively easier to follow variables. Signed-off-by: Karl Palsson <karlp@etactica.com>
Diffstat (limited to 'lua/uloop.c')
-rw-r--r--lua/uloop.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/lua/uloop.c b/lua/uloop.c
index 394970d..ee82104 100644
--- a/lua/uloop.c
+++ b/lua/uloop.c
@@ -233,24 +233,23 @@ static int ul_ufd_add(lua_State *L)
int ref;
int fd_ref;
- flags = luaL_checkinteger(L, -1);
+ flags = luaL_checkinteger(L, 3);
if (!flags) {
lua_pushstring(L, "flags cannot be zero");
lua_error(L);
}
- lua_pop(L, 1);
- luaL_checktype(L, -1, LUA_TFUNCTION);
+ luaL_checktype(L, 2, LUA_TFUNCTION);
- fd = get_sock_fd(L, -2);
+ fd = get_sock_fd(L, 1);
lua_getglobal(L, "__uloop_cb");
- lua_pushvalue(L, -2);
+ lua_pushvalue(L, 2);
ref = luaL_ref(L, -2);
lua_pop(L, 1);
lua_getglobal(L, "__uloop_fds");
- lua_pushvalue(L, -3);
+ lua_pushvalue(L, 1);
fd_ref = luaL_ref(L, -2);
lua_pop(L, 1);