diff options
author | Allan Stephens <Allan.Stephens@windriver.com> | 2010-12-31 18:59:33 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-01 13:57:56 -0800 |
commit | 2db9983a4318818845193bd577879c0620705e82 (patch) | |
tree | a77ed030edde71edb1c1b781f580cdfd642ac70d /net/tipc/link.c | |
parent | 0e65967e33be61e5f67727edd4ea829b47676fc0 (diff) | |
download | linux-3.10-2db9983a4318818845193bd577879c0620705e82.tar.gz linux-3.10-2db9983a4318818845193bd577879c0620705e82.tar.bz2 linux-3.10-2db9983a4318818845193bd577879c0620705e82.zip |
tipc: split variable assignments out of conditional expressions
Cleans up TIPC's source code to eliminate assigning values to variables
within conditional expressions, improving code readability and reducing
warnings from various code checker tools.
These changes are purely cosmetic and do not alter the operation of TIPC
in any way.
Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r-- | net/tipc/link.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c index ef203a1581c..de9d49108d4 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -187,14 +187,17 @@ static int link_name_validate(const char *name, struct link_name *name_parts) /* ensure all component parts of link name are present */ addr_local = name_copy; - if ((if_local = strchr(addr_local, ':')) == NULL) + if_local = strchr(addr_local, ':'); + if (if_local == NULL) return 0; *(if_local++) = 0; - if ((addr_peer = strchr(if_local, '-')) == NULL) + addr_peer = strchr(if_local, '-'); + if (addr_peer == NULL) return 0; *(addr_peer++) = 0; if_local_len = addr_peer - if_local; - if ((if_peer = strchr(addr_peer, ':')) == NULL) + if_peer = strchr(addr_peer, ':'); + if (if_peer == NULL) return 0; *(if_peer++) = 0; if_peer_len = strlen(if_peer) + 1; @@ -2044,8 +2047,8 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) strcpy((strrchr(l_ptr->name, ':') + 1), (char *)msg_data(msg)); - if ((msg_tol = msg_link_tolerance(msg)) && - (msg_tol > l_ptr->tolerance)) + msg_tol = msg_link_tolerance(msg); + if (msg_tol > l_ptr->tolerance) link_set_supervision_props(l_ptr, msg_tol); if (msg_linkprio(msg) > l_ptr->priority) @@ -2074,7 +2077,8 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) break; case STATE_MSG: - if ((msg_tol = msg_link_tolerance(msg))) + msg_tol = msg_link_tolerance(msg); + if (msg_tol) link_set_supervision_props(l_ptr, msg_tol); if (msg_linkprio(msg) && |