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:
parent
87f52974ba
commit
599f2311a8
@ -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_class_function(lua_State *L, const char *name, int (*function)(lua_State *L));
|
||||||
void *hlua_checkudata(lua_State *L, int ud, int class_ref);
|
void *hlua_checkudata(lua_State *L, int ud, int class_ref);
|
||||||
int hlua_register_metatable(struct lua_State *L, char *name);
|
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_post_init(lua_State *L);
|
||||||
int hlua_fcn_reg_core_fcn(lua_State *L);
|
|
||||||
int hlua_dump_object(lua_State *L);
|
int hlua_dump_object(lua_State *L);
|
||||||
|
|
||||||
#endif /* _HAPROXY_HLUA_FCN_H */
|
#endif /* _HAPROXY_HLUA_FCN_H */
|
||||||
|
@ -462,7 +462,7 @@ static int concat_tostring(lua_State *L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hlua_concat_init(lua_State *L)
|
static void hlua_concat_init(lua_State *L)
|
||||||
{
|
{
|
||||||
/* Creates the buffered concat object. */
|
/* Creates the buffered concat object. */
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
@ -484,8 +484,6 @@ static int hlua_concat_init(lua_State *L)
|
|||||||
|
|
||||||
lua_settable(L, -3); /* Sets the __index entry. */
|
lua_settable(L, -3); /* Sets the __index entry. */
|
||||||
class_concat_ref = luaL_ref(L, LUA_REGISTRYINDEX);
|
class_concat_ref = luaL_ref(L, LUA_REGISTRYINDEX);
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int hlua_fcn_new_stktable(lua_State *L, struct stktable *tbl)
|
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;
|
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))
|
hlua_concat_init(L);
|
||||||
return 0;
|
|
||||||
|
|
||||||
hlua_class_function(L, "now", hlua_now);
|
hlua_class_function(L, "now", hlua_now);
|
||||||
hlua_class_function(L, "http_date", hlua_http_date);
|
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 */
|
lua_settable(L, -3); /* -> META["__index"] = TABLE */
|
||||||
class_proxy_ref = hlua_register_metatable(L, CLASS_PROXY);
|
class_proxy_ref = hlua_register_metatable(L, CLASS_PROXY);
|
||||||
|
|
||||||
return 5;
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user