Template
1
0
mirror of https://github.com/bol-van/zapret2.git synced 2026-03-14 06:13:09 +00:00

nfqws2: simplify complex unwinds in lua code

This commit is contained in:
bol-van
2026-01-15 11:46:36 +03:00
parent f919533873
commit c3adb3f045
2 changed files with 3 additions and 5 deletions

View File

@@ -1664,7 +1664,7 @@ static bool lua_reconstruct_ip6exthdr(lua_State *L, int idx, struct ip6_hdr *ip6
LUA_STACK_GUARD_LEAVE(L, 0)
return true;
err:
LUA_STACK_GUARD_UNWIND_RETURN(L, 0)
LUA_STACK_GUARD_UNWIND(L)
return false;
}
bool lua_reconstruct_ip6hdr(lua_State *L, int idx, struct ip6_hdr *ip6, size_t *len, uint8_t last_proto, bool preserve_next)
@@ -1910,7 +1910,7 @@ end:
LUA_STACK_GUARD_LEAVE(L, 0)
return true;
err:
LUA_STACK_GUARD_UNWIND_RETURN(L, 0)
LUA_STACK_GUARD_UNWIND(L)
return false;
}
bool lua_reconstruct_tcphdr(lua_State *L, int idx, struct tcphdr *tcp, size_t *len)
@@ -2199,7 +2199,7 @@ bool lua_reconstruct_dissect(lua_State *L, int idx, uint8_t *buf, size_t *len, b
LUA_STACK_GUARD_LEAVE(L, 0)
return true;
err:
LUA_STACK_GUARD_UNWIND_RETURN(L, 0)
LUA_STACK_GUARD_UNWIND(L)
return false;
}
static int luacall_reconstruct_dissect(lua_State *L)

View File

@@ -39,8 +39,6 @@
#define LUA_STACK_GUARD_LEAVE(L,N) if ((_lsg+N)!=lua_gettop(L)) luaL_error(L,"stack guard failure");
#define LUA_STACK_GUARD_RETURN(L,N) LUA_STACK_GUARD_LEAVE(L,N); return N;
#define LUA_STACK_GUARD_UNWIND(L) lua_settop(L,_lsg);
#define LUA_STACK_GUARD_UNWIND_RETURN(L,N) LUA_STACK_GUARD_UNWIND(L); return N;
void desync_instance(const char *func, unsigned int dp_n, unsigned int func_n, char *instance, size_t inst_size);