]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream-int: make si_appctx() never fail
authorWilly Tarreau <w@1wt.eu>
Thu, 20 Sep 2018 09:08:47 +0000 (11:08 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 20 Sep 2018 09:42:15 +0000 (11:42 +0200)
Callers of si_appctx() always use the result without checking it because
they know by construction that it's valid. This results in unchecked null
pointer warnings at -Wextra, so let's remove this test and make it clear
that it's up to the caller to check validity first.

include/proto/stream_interface.h

index a9dca8253893993dfea8a8765e5d0c20ddc4af51..74537b976468deb986542e5a40cbd4c1194804f2 100644 (file)
@@ -227,10 +227,10 @@ static inline void si_attach_appctx(struct stream_interface *si, struct appctx *
        appctx->owner = si;
 }
 
-/* returns a pointer to the appctx being run in the SI or NULL if none */
+/* returns a pointer to the appctx being run in the SI, which must be valid */
 static inline struct appctx *si_appctx(struct stream_interface *si)
 {
-       return objt_appctx(si->end);
+       return __objt_appctx(si->end);
 }
 
 /* call the applet's release function if any. Needs to be called upon close() */
@@ -238,7 +238,7 @@ static inline void si_applet_release(struct stream_interface *si)
 {
        struct appctx *appctx;
 
-       appctx = si_appctx(si);
+       appctx = objt_appctx(si->end);
        if (appctx && appctx->applet->release && si->state < SI_ST_DIS)
                appctx->applet->release(appctx);
 }