NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/51192: src/usr.bin/tip/aculib/v831.c:252]: (style) Redundant condition
The following reply was made to PR bin/51192; it has been noted by GNATS.
From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: bin/51192: src/usr.bin/tip/aculib/v831.c:252]: (style) Redundant
condition
Date: Tue, 31 May 2016 04:04:33 +0000
On Mon, May 30, 2016 at 01:15:00PM +0000, dcb314%hotmail.com@localhost wrote:
> src/usr.bin/tip/aculib/v831.c:252]: (style) Redundant condition: If 'EXPR == '<'', the comparison 'EXPR != '_'' is always true.
>
> Source code is
>
> if (!isdigit((unsigned char)*s) && *s == '<' && *s != '_')
>
> Suggest new code
>
> if (!isdigit((unsigned char)*s) && *s == '<')
Surely you mean just: if (*s == '<') :-)
...but looking at it in context that's pretty clearly wrong. The
function appears to be intended to strip unwanted characters from
phone numbers before dialing, and it's clear from the call site that
'<' is supposed to be carried through.
I think it's supposed to be
if (!isdigit((unsigned char)*s) && *s != '<' && *s != '_')
Would someone who knows how tip thinks about phone numbers care to
comment?
--
David A. Holland
dholland%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index