From: Thierry Fournier Date: Mon, 22 Feb 2016 07:40:02 +0000 (+0100) Subject: CLEANUP: lua: Remove two same functions X-Git-Tag: v1.7-dev3~84 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4f99b27c3486801d1a986440e3527d3126523839;p=thirdparty%2Fhaproxy.git CLEANUP: lua: Remove two same functions The function hlua_array_add_fcn() is exactly the same than the function hlua_class_function(), so this patch removes the first one. --- diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c index f9e13918ab..ac8f033168 100644 --- a/src/hlua_fcn.c +++ b/src/hlua_fcn.c @@ -161,14 +161,6 @@ static int hlua_asctime_date(lua_State *L) return hlua_parse_date(L, parse_asctime_date); } -static void hlua_array_add_fcn(lua_State *L, const char *name, - int (*function)(lua_State *L)) -{ - lua_pushstring(L, name); - lua_pushcclosure(L, function, 0); - lua_rawset(L, -3); -} - static struct hlua_concat *hlua_check_concat(lua_State *L, int ud) { return (struct hlua_concat *)(hlua_checkudata(L, ud, class_concat_ref)); @@ -291,11 +283,12 @@ int hlua_fcn_reg_core_fcn(lua_State *L) if (!hlua_concat_init(L)) return 0; - hlua_array_add_fcn(L, "now", hlua_now); - hlua_array_add_fcn(L, "http_date", hlua_http_date); - hlua_array_add_fcn(L, "imf_date", hlua_imf_date); - hlua_array_add_fcn(L, "rfc850_date", hlua_rfc850_date); - hlua_array_add_fcn(L, "asctime_date", hlua_asctime_date); - hlua_array_add_fcn(L, "concat", hlua_concat_new); + hlua_class_function(L, "now", hlua_now); + hlua_class_function(L, "http_date", hlua_http_date); + hlua_class_function(L, "imf_date", hlua_imf_date); + hlua_class_function(L, "rfc850_date", hlua_rfc850_date); + hlua_class_function(L, "asctime_date", hlua_asctime_date); + hlua_class_function(L, "concat", hlua_concat_new); + return 5; }