From: Tim Duesterhus Date: Fri, 21 Feb 2020 12:02:03 +0000 (+0100) Subject: CLEANUP: conn: Do not pass a pointer to likely X-Git-Tag: v2.2-dev3~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=927063b8920c275ad6599b4cafc7b8742f5cc626;p=thirdparty%2Fhaproxy.git CLEANUP: conn: Do not pass a pointer to likely Move the `!` inside the likely and negate it to unlikely. The previous version should not have caused issues, because it is converted to a boolean / integral value before being passed to __builtin_expect(), but it's certainly unusual. [wt: this was not a bug but purposely written like this to improve code generation on older compilers but not needed anymore as described here: https://www.mail-archive.com/haproxy@formilux.org/msg36392.html ] --- diff --git a/include/proto/connection.h b/include/proto/connection.h index c7caeea2b1..fb264d2b59 100644 --- a/include/proto/connection.h +++ b/include/proto/connection.h @@ -400,12 +400,12 @@ static inline struct conn_stream *cs_new(struct connection *conn) struct conn_stream *cs; cs = pool_alloc(pool_head_connstream); - if (!likely(cs)) + if (unlikely(!cs)) return NULL; if (!conn) { conn = conn_new(); - if (!likely(conn)) { + if (unlikely(!conn)) { cs_free(cs); return NULL; }