From: Willy Tarreau Date: Wed, 17 Jun 2015 17:49:52 +0000 (+0200) Subject: BUILD/MINOR: stats: fix build warning due to condition always true X-Git-Tag: v1.6-dev3~52 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=666f5049069e2d05bd31b421f7cffb12545d29af;p=thirdparty%2Fhaproxy.git BUILD/MINOR: stats: fix build warning due to condition always true Dmitry Sivachenko reported the following harmless build warning using Clang : src/dumpstats.c:5196:48: warning: address of array 'strm_li(sess)->proto->name' will always evaluate to 'true' [-Wpointer-bool-conversion] ...strm_li(sess) && strm_li(sess)->proto->name ? strm_li(sess)->proto->nam... ~~ ~~~~~~~~~~~~~~~~~~~~~~^~~~ proto->name cannot be null here as it's the protocol name which is stored directly in the structure. The same case is present in 1.5 though the code changed. --- diff --git a/src/dumpstats.c b/src/dumpstats.c index 96180fe710..c8bdc2b6ac 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -5193,7 +5193,7 @@ static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct st tm.tm_mday, monthname[tm.tm_mon], tm.tm_year+1900, tm.tm_hour, tm.tm_min, tm.tm_sec, (int)(sess->logs.accept_date.tv_usec), sess->uniq_id, - strm_li(sess) && strm_li(sess)->proto->name ? strm_li(sess)->proto->name : "?"); + strm_li(sess) ? strm_li(sess)->proto->name : "?"); conn = objt_conn(strm_orig(sess)); switch (conn ? addr_to_str(&conn->addr.from, pn, sizeof(pn)) : AF_UNSPEC) {