MINOR: hlua: some luaL_checktype() calls were not guarded with MAY_LJMP

In hlua code, we mark every function that may longjump using
MAY_LJMP macro so it's easier to identify them by reading the code.

However, some luaL_checktypes() were performed without the MAY_LJMP.

According to lua doc:
	Functions called luaL_check* always raise an error if
	the check is not satisfied.

-> Adding the missing MAY_LJMP for those luaLchecktypes() calls.

No backport needed.
This commit is contained in:
Aurelien DARRAGON 2022-10-05 11:46:45 +02:00 committed by Christopher Faulet
parent 487d04f6d7
commit d83d045cda

View File

@ -8232,7 +8232,7 @@ __LJMP static int hlua_txn_reply_set_status(lua_State *L)
const char *reason = MAY_LJMP(luaL_optlstring(L, 3, NULL, NULL)); const char *reason = MAY_LJMP(luaL_optlstring(L, 3, NULL, NULL));
/* First argument (self) must be a table */ /* First argument (self) must be a table */
luaL_checktype(L, 1, LUA_TTABLE); MAY_LJMP(luaL_checktype(L, 1, LUA_TTABLE));
if (status < 100 || status > 599) { if (status < 100 || status > 599) {
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
@ -8262,7 +8262,7 @@ __LJMP static int hlua_txn_reply_add_header(lua_State *L)
int ret; int ret;
/* First argument (self) must be a table */ /* First argument (self) must be a table */
luaL_checktype(L, 1, LUA_TTABLE); MAY_LJMP(luaL_checktype(L, 1, LUA_TTABLE));
/* Push in the stack the "headers" entry. */ /* Push in the stack the "headers" entry. */
ret = lua_getfield(L, 1, "headers"); ret = lua_getfield(L, 1, "headers");
@ -8308,7 +8308,7 @@ __LJMP static int hlua_txn_reply_del_header(lua_State *L)
int ret; int ret;
/* First argument (self) must be a table */ /* First argument (self) must be a table */
luaL_checktype(L, 1, LUA_TTABLE); MAY_LJMP(luaL_checktype(L, 1, LUA_TTABLE));
/* Push in the stack the "headers" entry. */ /* Push in the stack the "headers" entry. */
ret = lua_getfield(L, 1, "headers"); ret = lua_getfield(L, 1, "headers");
@ -8331,7 +8331,7 @@ __LJMP static int hlua_txn_reply_set_body(lua_State *L)
const char *payload = MAY_LJMP(luaL_checkstring(L, 2)); const char *payload = MAY_LJMP(luaL_checkstring(L, 2));
/* First argument (self) must be a table */ /* First argument (self) must be a table */
luaL_checktype(L, 1, LUA_TTABLE); MAY_LJMP(luaL_checktype(L, 1, LUA_TTABLE));
lua_pushstring(L, payload); lua_pushstring(L, payload);
lua_setfield(L, 1, "body"); lua_setfield(L, 1, "body");