From: Willy Tarreau Date: Wed, 14 Dec 2016 14:41:45 +0000 (+0100) Subject: CLEANUP: applet/lua: create a dedicated ->fcn entry in hlua_cli context X-Git-Tag: v1.8-dev1~280 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8ae4f7533d5dfe01c2fa15c4b1b803bc3aa7beaf;p=thirdparty%2Fhaproxy.git CLEANUP: applet/lua: create a dedicated ->fcn entry in hlua_cli context 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. --- diff --git a/include/types/applet.h b/include/types/applet.h index 89602aac56..57ec6fd4a6 100644 --- a/include/types/applet.h +++ b/include/types/applet.h @@ -126,6 +126,7 @@ struct appctx { struct { struct hlua hlua; struct task *task; + struct hlua_function *fcn; } hlua_cli; struct { struct hlua hlua; diff --git a/src/hlua.c b/src/hlua.c index 33ca98dd2b..09ccdbca22 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -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))