[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1461093152.1917.26.camel@perches.com>
Date: Tue, 19 Apr 2016 12:12:32 -0700
From: Joe Perches <joe@...ches.com>
To: Julia Lawall <julia.lawall@...6.fr>
Cc: cocci <cocci@...teme.lip6.fr>, LKML <linux-kernel@...r.kernel.org>
Subject: coccinelle: bool if (foo) return true; else return false;
There's ~150 of these in the kernel.
Maybe there's use for this conversion to be added
to scripts/coccinelle/misc/boolreturn.cocci or in
a separate file.
$ cat booltruefalse.cocci
@@
identifier fn;
expression e;
typedef bool;
symbol true;
symbol false;
@@
bool fn ( ... )
{
<...
- if (e) return true; else return false;
+ return e;
...>
}
@@
identifier fn;
expression e;
@@
bool fn ( ... )
{
<...
- if (e) return false; else return true;
+ return !e;
...>
}
Powered by blists - more mailing lists