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.
diff --git a/include/haproxy/hlua_fcn.h b/include/haproxy/hlua_fcn.h
index 0ee2183..dca345a 100644
--- a/include/haproxy/hlua_fcn.h
+++ b/include/haproxy/hlua_fcn.h
@@ -31,8 +31,8 @@
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 */
diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c
index 975ed24..af5fdf4 100644
--- a/src/hlua_fcn.c
+++ b/src/hlua_fcn.c
@@ -462,7 +462,7 @@
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 @@
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 @@
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 @@
lua_settable(L, -3); /* -> META["__index"] = TABLE */
class_proxy_ref = hlua_register_metatable(L, CLASS_PROXY);
- return 5;
}