]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: lua: Remove two same functions
authorThierry Fournier <tfournier@arpalert.org>
Mon, 22 Feb 2016 07:40:02 +0000 (08:40 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 30 Mar 2016 13:43:25 +0000 (15:43 +0200)
The function hlua_array_add_fcn() is exactly the same than the function
hlua_class_function(), so this patch removes the first one.

src/hlua_fcn.c

index f9e13918abcf8cb7d3821514d7d52f6bc336de03..ac8f033168e2b000de522e338c64b8ab7db2178a 100644 (file)
@@ -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;
 }