Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Oct 2011 12:21:31 +0200
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Ed Schouten <ed@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r226360 - head/usr.bin/tr
Message-ID:  <20111014102131.GA31718@stack.nl>
In-Reply-To: <201110140725.p9E7PLbL052182@svn.freebsd.org>
References:  <201110140725.p9E7PLbL052182@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Oct 14, 2011 at 07:25:21AM +0000, Ed Schouten wrote:
> Author: ed
> Date: Fri Oct 14 07:25:20 2011
> New Revision: 226360
> URL: http://svn.freebsd.org/changeset/base/226360

> Log:
>   Build tr(1) with WARNS=6.

> Modified:
>   head/usr.bin/tr/Makefile
>   head/usr.bin/tr/cset.c
>   head/usr.bin/tr/str.c

> Modified: head/usr.bin/tr/cset.c
> ==============================================================================
> --- head/usr.bin/tr/cset.c	Fri Oct 14 07:24:48 2011	(r226359)
> +++ head/usr.bin/tr/cset.c	Fri Oct 14 07:25:20 2011	(r226360)
> @@ -153,11 +153,11 @@ cset_in_hard(struct cset *cs, wchar_t ch
>  	struct csclass *csc;
>  
>  	for (csc = cs->cs_classes; csc != NULL; csc = csc->csc_next)
> -		if (csc->csc_invert ^ iswctype(ch, csc->csc_type) != 0)
> +		if ((csc->csc_invert ^ iswctype(ch, csc->csc_type)) != 0)
>  			return (cs->cs_invert ^ true);
>  	if (cs->cs_root != NULL) {
>  		cs->cs_root = cset_splay(cs->cs_root, ch);
> -		return (cs->cs_invert ^ cset_rangecmp(cs->cs_root, ch) == 0);
> +		return ((cs->cs_invert ^ cset_rangecmp(cs->cs_root, ch)) == 0);
>  	}
>  	return (cs->cs_invert ^ false);
>  }

These two changes are wrong. Contrary to what one might expect, the !=
and == operators bind more strongly than the ^ operator, and the
original code depends on that.

-- 
Jilles Tjoelker



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111014102131.GA31718>