From 96f32b9e6fe70bae429c1feb2c711e1293f3a31d Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Mon, 7 Jan 2013 17:07:52 +0100 Subject: Correct "Suspicious condition (assignment + comparison)" (Thomas Jarosch) cppcheck (vaguely) reported: [lib/parse.c:448]: (style) Suspicious condition (assignment + comparison); Clarify expression with parentheses. --- lib/parse.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/parse.c b/lib/parse.c index 550048c..951d2f3 100644 --- a/lib/parse.c +++ b/lib/parse.c @@ -442,11 +442,10 @@ ipset_parse_proto(struct ipset_session *session, protoent = getprotobyname(strcasecmp(str, "icmpv6") == 0 ? "ipv6-icmp" : str); if (protoent == NULL) { - uint8_t protonum; - int err; + uint8_t protonum = 0; - if (!((err = string_to_u8(session, str, &protonum) == 0) && - (protoent = getprotobynumber(protonum)) != NULL)) + if (string_to_u8(session, str, &protonum) || + (protoent = getprotobynumber(protonum)) == NULL) return syntax_err("cannot parse '%s' " "as a protocol", str); } -- cgit v1.2.3