MINOR: hlua: Fix two functions that return nothing useful

Two lua init function seems to return something useful, but it
is not the case. The function "hlua_concat_init" seems to return
a failure status, but the function never fails. The function
"hlua_fcn_reg_core_fcn" seems to return a number of elements in
the stack, but it is not the case.
This commit is contained in:
Thierry Fournier 2022-09-30 10:40:39 +02:00 committed by Christopher Faulet
parent 87f52974ba
commit 599f2311a8
2 changed files with 4 additions and 8 deletions

View File

@ -31,8 +31,8 @@ void hlua_class_const_str(lua_State *L, const char *name, const char *value);
void hlua_class_function(lua_State *L, const char *name, int (*function)(lua_State *L));
void *hlua_checkudata(lua_State *L, int ud, int class_ref);
int hlua_register_metatable(struct lua_State *L, char *name);
void hlua_fcn_reg_core_fcn(lua_State *L);
int hlua_fcn_post_init(lua_State *L);
int hlua_fcn_reg_core_fcn(lua_State *L);
int hlua_dump_object(lua_State *L);
#endif /* _HAPROXY_HLUA_FCN_H */

View File

@ -462,7 +462,7 @@ static int concat_tostring(lua_State *L)
return 1;
}
static int hlua_concat_init(lua_State *L)
static void hlua_concat_init(lua_State *L)
{
/* Creates the buffered concat object. */
lua_newtable(L);
@ -484,8 +484,6 @@ static int hlua_concat_init(lua_State *L)
lua_settable(L, -3); /* Sets the __index entry. */
class_concat_ref = luaL_ref(L, LUA_REGISTRYINDEX);
return 1;
}
int hlua_fcn_new_stktable(lua_State *L, struct stktable *tbl)
@ -1682,10 +1680,9 @@ static int hlua_regex_free(struct lua_State *L)
return 0;
}
int hlua_fcn_reg_core_fcn(lua_State *L)
void hlua_fcn_reg_core_fcn(lua_State *L)
{
if (!hlua_concat_init(L))
return 0;
hlua_concat_init(L);
hlua_class_function(L, "now", hlua_now);
hlua_class_function(L, "http_date", hlua_http_date);
@ -1776,5 +1773,4 @@ int hlua_fcn_reg_core_fcn(lua_State *L)
lua_settable(L, -3); /* -> META["__index"] = TABLE */
class_proxy_ref = hlua_register_metatable(L, CLASS_PROXY);
return 5;
}