svn commit: r226360 - head/usr.bin/tr

Jilles Tjoelker jilles at stack.nl
Fri Oct 14 10:21:33 UTC 2011


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


More information about the svn-src-head mailing list