]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: conn-stream: Improve API to have safe/unsafe accessors
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 28 Feb 2022 07:45:41 +0000 (08:45 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 28 Feb 2022 16:13:36 +0000 (17:13 +0100)
commite645d88c6b55bccc0a1c4046cd993c73762560c4
tree8b8bcf43308772d51b55e1088fef88dda27a6e08
parent68ae291cd20f91581b85dca1a13a58c0db492196
MINOR: conn-stream: Improve API to have safe/unsafe accessors

Depending on the context, we know the endpoint or the application attached
to the conn_stream is defined and we know its type. However, having
accessors testing the endpoint or the application may lead the compiler to
report possible null derefs here and there. The alternative is to add
useless tests or use ALREAD_CHECKED/DISGUISE macros. It is tedious and
inelegant.

So now, similarily to the ob API, the safe API, testing
endpoint/application, relies on an unsafe one (same name prefixed with
'__'). This way, any caller may use the unsafe API when it is relevant.

In addition, there is no reason to test the conn-stream itself. It is the
caller responsibility to be sure there is a conn-stream to get its endpoint
or its application. And most of type, we are sure to have a conn-stream.
include/haproxy/conn_stream.h