lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1323243563.1762.42.camel@joe2Laptop>
Date:	Tue, 06 Dec 2011 23:39:23 -0800
From:	Joe Perches <joe@...ches.com>
To:	Al Viro <viro@...IV.linux.org.uk>
Cc:	Michael Wang <wangyun@...ux.vnet.ibm.com>,
	jeffrey.t.kirsher@...el.com,
	"e1000-devel@...ts.sourceforge.net" 
	<e1000-devel@...ts.sourceforge.net>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"wangyunlinux@...il.com" <wangyunlinux@...il.com>,
	"Brandeburg, Jesse" <jesse.brandeburg@...el.com>
Subject: Re: [PATCH v2] e1000e: Assign true and false to bool type variable
 instead of 1 and 0

On Wed, 2011-12-07 at 07:20 +0000, Al Viro wrote:
> On Wed, Dec 07, 2011 at 02:36:20PM +0800, Michael Wang wrote:
> > On 12/07/2011 02:19 PM, Joe Perches wrote:
> 
> [snip]
> > >  	if (*i2cctl & IXGBE_I2C_DATA_IN)
> > > -		data = 1;
> > > +		data = true;
> > >  	else
> > > -		data = 0;
> > > +		data = false;
> > > 
> > >  	return data;
> 
> Yuck...
> 
> bool f(whatever)
> {
> 	bool data;
> 	if (expression)
> 		data = true;
> 	else
> 		data = false;
> 	return data;
> }
> 
> is amazingly unidiomatic.  Hell, if nothing else it's
> 	bool data = expression;
> 	return data;
> if not an outright
> 	return expression;
> or
> 	return (bool)expression;
> if you want to underline that it's treated as boolean...  What tool
> has produced that patch?

tool has multiple meanings... :)

In this case though it's spatch (coccinelle)

I looked at it and thought the same thing as you.

The point though was not to do the idiomatic
transform that you correctly describe, but to
get Michael Wang to look at spatch as a tool
to do those transforms.

cheers, Joe

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ