]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: applet: Uninline appctx_free()
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 29 Mar 2023 15:37:48 +0000 (17:37 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 5 Apr 2023 06:46:06 +0000 (08:46 +0200)
This functin is uninlined and move in src/applet.c. It is mandatory to add
traces for applets.

include/haproxy/applet.h
src/applet.c

index e610ba4f66e14b295f9bbcecec0d1b4feae1af32..b805440e6b8a156b096d8f93dca7b4b205e54bf9 100644 (file)
@@ -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.
  */
index 63ee15588130984f63e625c30d184386d64cbc49..a79bc63a8473c794835b06c1aa68850a203fcece 100644 (file)
@@ -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 <size> bytes in the <appctx>, 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