lkml.org 
[lkml]   [2011]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] coccinelle: if(ret)return ret; return ret; semantic patch
    On Sun, 5 Jun 2011, Greg Dietsche wrote:

    > This semantic patch finds code matching this pattern:
    > if(ret)
    > return ret;
    > return ret;
    >
    > I will be submitting patches shortly against the mainline to cleanup all
    > code matching this pattern.
    >
    > Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>
    > ---
    > scripts/coccinelle/misc/doublereturn.cocci | 20 ++++++++++++++++++++
    > 1 files changed, 20 insertions(+), 0 deletions(-)
    > create mode 100644 scripts/coccinelle/misc/doublereturn.cocci
    >
    > diff --git a/scripts/coccinelle/misc/doublereturn.cocci b/scripts/coccinelle/misc/doublereturn.cocci
    > new file mode 100644
    > index 0000000..656a118
    > --- /dev/null
    > +++ b/scripts/coccinelle/misc/doublereturn.cocci
    > @@ -0,0 +1,20 @@
    > +/// Remove unecessary if/return in code that follows this pattern:
    > +/// if(retval)
    > +/// return retval;
    > +/// return retval;
    > +//
    > +// Confidence: High
    > +// Copyright: (C) 2011 Greg Dietsche GPLv2.
    > +// URL: http://www.gregd.org
    > +// Comments:
    > +// Options: -no_includes
    > +
    > +virtual patch
    > +
    > +@@

    This line should be @depends on patch@

    julia

    > +identifier retval;
    > +@@
    > +-if (retval)
    > +- return retval;
    > +-return retval;
    > ++return retval;
    > --
    > 1.7.2.5
    >
    >


    \
     
     \ /
      Last update: 2011-06-06 06:59    [W:0.026 / U:2.756 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site