]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: applet/lua: create a dedicated ->fcn entry in hlua_cli context
authorWilly Tarreau <w@1wt.eu>
Wed, 14 Dec 2016 14:41:45 +0000 (15:41 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 14 Dec 2016 15:48:16 +0000 (16:48 +0100)
We have very few users of the appctx's private field which was introduced
prior to the split of the CLI. Unfortunately it was not removed after the
end. This commit simply introduces hlua_cli->fcn which is the pointer to
the Lua function that the Lua code used to store in this private pointer.

include/types/applet.h
src/hlua.c

index 89602aac5633240bb94ff7bb598dfa16297e9748..57ec6fd4a627a0e4cc16b423617f0cbc27a44e5c 100644 (file)
@@ -126,6 +126,7 @@ struct appctx {
                struct {
                        struct hlua hlua;
                        struct task *task;
+                       struct hlua_function *fcn;
                } hlua_cli;
                struct {
                        struct hlua hlua;
index 33ca98dd2bcefb1803265c3feead5062429f82aa..09ccdbca220dfca0c1590a5b01787fbb2e9b876d 100644 (file)
@@ -6620,8 +6620,8 @@ static int hlua_cli_parse_fct(char **args, struct appctx *appctx, void *private)
        const char *error;
 
        hlua = &appctx->ctx.hlua_cli.hlua;
+       appctx->ctx.hlua_cli.fcn = private;
        fcn = private;
-       appctx->private = private;
 
        /* Create task used by signal to wakeup applets.
         * We use the same wakeup fonction than the Lua applet_tcp and
@@ -6707,7 +6707,7 @@ static int hlua_cli_io_handler_fct(struct appctx *appctx)
 
        hlua = &appctx->ctx.hlua_cli.hlua;
        si = appctx->owner;
-       fcn = appctx->private;
+       fcn = appctx->ctx.hlua_cli.fcn;
 
        /* If the stream is disconnect or closed, ldo nothing. */
        if (unlikely(si->state == SI_ST_DIS || si->state == SI_ST_CLO))