diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2014-09-08 16:16:29 +0200 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2014-09-08 16:16:29 +0200 |
commit | 01056309418e2ef06b23da03f129d7490aa13d34 (patch) | |
tree | d4a7af1f9ad2610719ef1f9b1fbdd955913b65e3 /flowtop.c | |
parent | 5b8ec08d57fa932b769e590ecfe6a471910c05ec (diff) |
flowtop: Simplify entry skip logic
Instead of testing three skip conditions for every entry, make use of
the short-circuit evaluation of the boolean OR operator to only test as
few conditions as necessary.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'flowtop.c')
-rw-r--r-- | flowtop.c | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -937,16 +937,11 @@ static void presenter_screen_update(WINDOW *screen, struct flow_list *fl, for (j = 0; j < protocol_state_size[protocols[i]]; j++) { n = rcu_dereference(fl->head); while (n && maxy > 0) { - int skip_entry = 0; - - if (n->l4_proto != protocols[i]) - skip_entry = 1; - if (presenter_flow_wrong_state(n, j)) - skip_entry = 1; - if (presenter_get_port(n->port_src, - n->port_dst, 0) == 53) - skip_entry = 1; - if (skip_entry) { + if (n->l4_proto != protocols[i] || + presenter_flow_wrong_state(n, j) || + presenter_get_port(n->port_src, + n->port_dst, 0) == 53) { + /* skip entry */ n = rcu_dereference(n->next); continue; } |