From: Christopher Faulet Date: Wed, 29 Mar 2023 15:37:48 +0000 (+0200) Subject: MINOR: applet: Uninline appctx_free() X-Git-Tag: v2.8-dev7~102 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a5915eb1dd9b2b80f8afe11b272768eb94db390b;p=thirdparty%2Fhaproxy.git MINOR: applet: Uninline appctx_free() This functin is uninlined and move in src/applet.c. It is mandatory to add traces for applets. --- diff --git a/include/haproxy/applet.h b/include/haproxy/applet.h index e610ba4f66..b805440e6b 100644 --- a/include/haproxy/applet.h +++ b/include/haproxy/applet.h @@ -46,6 +46,7 @@ void appctx_shut(struct appctx *appctx); struct appctx *appctx_new_on(struct applet *applet, struct sedesc *sedesc, int thr); int appctx_finalize_startup(struct appctx *appctx, struct proxy *px, struct buffer *input); void appctx_free_on_early_error(struct appctx *appctx); +void appctx_free(struct appctx *appctx); static inline struct appctx *appctx_new_here(struct applet *applet, struct sedesc *sedesc) { @@ -88,22 +89,6 @@ static inline void __appctx_free(struct appctx *appctx) _HA_ATOMIC_DEC(&nb_applets); } -static inline void appctx_free(struct appctx *appctx) -{ - /* The task is supposed to be run on this thread, so we can just - * check if it's running already (or about to run) or not - */ - if (!(appctx->t->state & (TASK_QUEUED | TASK_RUNNING))) - __appctx_free(appctx); - else { - /* if it's running, or about to run, defer the freeing - * until the callback is called. - */ - appctx->state |= APPLET_WANT_DIE; - task_wakeup(appctx->t, TASK_WOKEN_OTHER); - } -} - /* wakes up an applet when conditions have changed. We're using a macro here in * order to retrieve the caller's place. */ diff --git a/src/applet.c b/src/applet.c index 63ee155881..a79bc63a84 100644 --- a/src/applet.c +++ b/src/applet.c @@ -125,6 +125,23 @@ void appctx_free_on_early_error(struct appctx *appctx) appctx_free(appctx); } +void appctx_free(struct appctx *appctx) +{ + /* The task is supposed to be run on this thread, so we can just + * check if it's running already (or about to run) or not + */ + if (!(appctx->t->state & (TASK_QUEUED | TASK_RUNNING))) { + __appctx_free(appctx); + } + else { + /* if it's running, or about to run, defer the freeing + * until the callback is called. + */ + appctx->state |= APPLET_WANT_DIE; + task_wakeup(appctx->t, TASK_WOKEN_OTHER); + } +} + /* reserves a command context of at least bytes in the , for * use by a CLI command or any regular applet. The pointer to this context is * stored in ctx.svcctx and is returned. The caller doesn't need to release