NetBSD Problem Report #51192
From www@NetBSD.org Mon May 30 13:13:58 2016
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 69E667ABD8
for <gnats-bugs@gnats.NetBSD.org>; Mon, 30 May 2016 13:13:58 +0000 (UTC)
Message-Id: <20160530131357.92AD37ABDC@mollari.NetBSD.org>
Date: Mon, 30 May 2016 13:13:57 +0000 (UTC)
From: dcb314@hotmail.com
Reply-To: dcb314@hotmail.com
To: gnats-bugs@NetBSD.org
Subject: src/usr.bin/tip/aculib/v831.c:252]: (style) Redundant condition
X-Send-Pr-Version: www-1.0
>Number: 51192
>Category: bin
>Synopsis: src/usr.bin/tip/aculib/v831.c:252]: (style) Redundant condition
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon May 30 13:15:00 +0000 2016
>Closed-Date: Thu Jun 30 06:00:57 +0000 2016
>Last-Modified: Thu Jun 30 06:00:57 +0000 2016
>Originator: David Binderman
>Release: cvs dated 20160529
>Organization:
>Environment:
>Description:
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 == '<')
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
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 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
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/51192 CVS commit: src/usr.bin/tip/aculib
Date: Thu, 30 Jun 2016 05:56:46 +0000
Module Name: src
Committed By: dholland
Date: Thu Jun 30 05:56:46 UTC 2016
Modified Files:
src/usr.bin/tip/aculib: v831.c
Log Message:
PR 51192 David Binderman: fix wrong logic (probably)
XXX: this file should probably just be deleted
To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/tip/aculib/v831.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Thu, 30 Jun 2016 06:00:57 +0000
State-Changed-Why:
fixed, thanks
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.