From 01056309418e2ef06b23da03f129d7490aa13d34 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 8 Sep 2014 16:16:29 +0200 Subject: 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 --- flowtop.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'flowtop.c') diff --git a/flowtop.c b/flowtop.c index 025e815..0fa9663 100644 --- a/flowtop.c +++ b/flowtop.c @@ -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; } -- cgit v1.2.3-54-g00ecf