lkml.org 
[lkml]   [2016]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Subjectcoccinelle: bool if (foo) return true; else return false;
From
Date
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;
...>
}


\
 
 \ /
  Last update: 2016-04-19 21:41    [W:0.423 / U:0.892 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site