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.
This commit is contained in:
Willy Tarreau 2015-06-17 19:49:52 +02:00
parent 22b0a68120
commit 666f504906

View 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) {