Date: Thu, 12 Jul 2018 09:46:39 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 229715] src/lib/libdevstat/devstat.c:760]: (style) Redundant condition Message-ID: <bug-229715-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D229715 Bug ID: 229715 Summary: src/lib/libdevstat/devstat.c:760]: (style) Redundant condition Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: misc Assignee: bugs@FreeBSD.org Reporter: dcb314@hotmail.com src/lib/libdevstat/devstat.c:760]: (style) Redundant condition: (matches[i].match_fields&DEVSTAT_MATCH_PASS)=3D=3D0. 'A || (!A && B)' is eq= uivalent to 'A || B' [src/lib/libdevstat/devstat.c:769]: (style) Redundant condition: (matches[i].match_fields&DEVSTAT_MATCH_PASS)=3D=3D0. 'A || (!A && B)' is eq= uivalent to 'A || B' Source code is if ((((matches[i].match_fields & DEVSTAT_MATCH_TYPE)!=3D0) && ((devices[j].device_type & DEVSTAT_TYPE_MASK) = =3D=3D (matches[i].device_type & DEVSTAT_TYPE_MASK= )) &&(((matches[i].match_fields & DEVSTAT_MATCH_PASS)!=3D0) || (((matches[i].match_fields & DEVSTAT_MATCH_PASS) =3D=3D 0) && ((devices[j].device_type & DEVSTAT_TYPE_PASS) =3D=3D 0))) && (--num_match_categories =3D=3D 0)) || (((matches[i].match_fields & DEVSTAT_MATCH_IF) = !=3D 0) && ((devices[j].device_type & DEVSTAT_TYPE_IF_MAS= K) =3D=3D (matches[i].device_type & DEVSTAT_TYPE_IF_MASK)) &&(((matches[i].match_fields & DEVSTAT_MATCH_PASS)!=3D0) || (((matches[i].match_fields & DEVSTAT_MATCH_PASS) =3D=3D 0) && ((devices[j].device_type & DEVSTAT_TYPE_PASS) =3D=3D 0))) && (--num_match_categories =3D=3D 0)) || (((matches[i].match_fields & DEVSTAT_MATCH_PASS)!=3D0) && ((devices[j].device_type & DEVSTAT_TYPE_PASS) = !=3D 0) && (--num_match_categories =3D=3D 0))) { 20 or so lines of if statement could IMHO do with some simplifying. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-229715-227>