]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD/MINOR: stats: fix build warning due to condition always true
authorWilly Tarreau <w@1wt.eu>
Wed, 17 Jun 2015 17:49:52 +0000 (19:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 17 Jun 2015 17:49:52 +0000 (19:49 +0200)
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.

src/dumpstats.c

index 96180fe710378fdb2626f36420fd1c79dcb3b404..c8bdc2b6ac77f49d619d3d70b09520eb06f901c4 100644 (file)
@@ -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) {