]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: lua: export hlua_pusherror() and check_args()
authorWilliam Lallemand <wlallemand@irq6.net>
Sat, 13 Jun 2026 18:49:43 +0000 (20:49 +0200)
committerWilliam Lallemand <wlallemand@irq6.net>
Sat, 13 Jun 2026 19:18:20 +0000 (21:18 +0200)
hlua_pusherror() and check_args() are being exported.

check_args() is now a macro to hlua_check_args() so it's not confusing
when called outside hlua.c.

include/haproxy/hlua.h
src/hlua.c

index 31a7af08309a6da9ade74e03321aff1d6fee10a8..ed9416b0516df27834e2e1aa613878efc657c0f3 100644 (file)
@@ -81,6 +81,15 @@ void hlua_pushref(lua_State *L, int ref);
 void hlua_unref(lua_State *L, int ref);
 struct hlua *hlua_gethlua(lua_State *L);
 void hlua_yieldk(lua_State *L, int nresults, lua_KContext ctx, lua_KFunction k, int timeout, unsigned int flags);
+int hlua_pusherror(lua_State *L, const char *fmt, ...);
+
+__LJMP static inline void hlua_check_args(lua_State *L, int nb, char *fcn)
+{
+       if (lua_gettop(L) == nb)
+               return;
+       WILL_LJMP(luaL_error(L, "'%s' needs %d arguments", fcn, nb));
+}
+#define check_args hlua_check_args
 
 #else /* USE_LUA */
 
index 124c8c1c0e77f2a52022b8bd47eb8f92076d4218..3ea6ec458a42e0336545b92b49b29d64b2f08188 100644 (file)
@@ -999,13 +999,6 @@ const char *hlua_traceback(lua_State *L, const char* sep)
  * stack. If the number of arguments available is not the same
  * then <nb> an error is thrown.
  */
-__LJMP static inline void check_args(lua_State *L, int nb, char *fcn)
-{
-       if (lua_gettop(L) == nb)
-               return;
-       WILL_LJMP(luaL_error(L, "'%s' needs %d arguments", fcn, nb));
-}
-
 /* This function pushes an error string prefixed by the file name
  * and the line number where the error is encountered.
  *
@@ -1022,7 +1015,7 @@ __LJMP static int _hlua_pusherror(lua_State *L)
 
        return 1;
 }
-static int hlua_pusherror(lua_State *L, const char *fmt, ...)
+int hlua_pusherror(lua_State *L, const char *fmt, ...)
 {
        va_list argp;
        int ret = 1;