MEDIUM: stream-int: replace occurrences of si->appctx with si_appctx()
We're about to remove si->appctx, so first let's replace all occurrences
of its usage with a dynamic extract from si->end. A lot of code was changed
by search-n-replace, but the behaviour was intentionally not altered.
The code surrounding calls to stream_int_register_handler() was slightly
changed since we can only use si->end *after* the registration.
diff --git a/include/proto/stream_interface.h b/include/proto/stream_interface.h
index 1cf9421..41a29ad 100644
--- a/include/proto/stream_interface.h
+++ b/include/proto/stream_interface.h
@@ -107,11 +107,20 @@
si->end = &si->appctx.obj_type;
}
+/* returns a pointer to the appctx being run in the SI or NULL if none */
+static inline struct appctx *si_appctx(struct stream_interface *si)
+{
+ return objt_appctx(si->end);
+}
+
/* returns a pointer to the applet being run in the SI or NULL if none */
static inline const struct si_applet *si_applet(struct stream_interface *si)
{
- if (objt_appctx(si->end))
- return si->appctx.applet;
+ const struct appctx *appctx;
+
+ appctx = si_appctx(si);
+ if (appctx)
+ return appctx->applet;
return NULL;
}