[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140905170222.1599ad33@urahara>
Date: Fri, 5 Sep 2014 17:02:22 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH iproute2] ip: support of usec rtt in tcp_metrics
On Fri, 05 Sep 2014 16:54:04 -0700
Eric Dumazet <eric.dumazet@...il.com> wrote:
> + if (i != TCP_METRIC_RTT &&
> + i != TCP_METRIC_RTT_US &&
> + i != TCP_METRIC_RTTVAR &&
> + i != TCP_METRIC_RTTVAR_US) {
> + if (metric_name[i])
> + fprintf(fp, " %s ", metric_name[i]);
> + else
> + fprintf(fp, " metric_%d ", i);
Why not put new metrics in metric_name array? and make the check something like:
if (i < ARRAY_SIZE(metric_name) && metric_name[i])
fprintf(fp, " %s ", metric_name[i]);
else
fprintf(fp, " metric_%d ", i)
This makes it future proof, and gets rid of the silly test.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists