From: Jozsef Kadlecsik Date: Mon, 7 Jan 2013 16:07:52 +0000 (+0100) Subject: Correct "Suspicious condition (assignment + comparison)" (Thomas Jarosch) X-Git-Tag: v6.17~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96f32b9e6fe70bae429c1feb2c711e1293f3a31d;p=thirdparty%2Fipset.git Correct "Suspicious condition (assignment + comparison)" (Thomas Jarosch) cppcheck (vaguely) reported: [lib/parse.c:448]: (style) Suspicious condition (assignment + comparison); Clarify expression with parentheses. --- diff --git a/lib/parse.c b/lib/parse.c index 550048c0..951d2f32 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); }