Subject: Re: [PATCH v2 01/32] rebase: 'make coccicheck' cleanup

From: SZEDER Gábor <[email-masked]>
Date: Tue, 9 Apr 2019 12:58:34 +0200

On Fri, Apr 05, 2019 at 04:26:10PM +0700, Duy Nguyen wrote:
> On Fri, Apr 5, 2019 at 12:25 AM SZEDER Gábor <[email-masked]> wrote:
> >
> > On Wed, Apr 03, 2019 at 06:34:26PM +0700, Nguyễn Thái Ngọc Duy wrote:
> > > Signed-off-by: Nguyễn Thái Ngọc Duy <[email-masked]>
> > > ---
> > >  builtin/rebase.c | 5 ++---
> > >  1 file changed, 2 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/builtin/rebase.c b/builtin/rebase.c
> > > index 77deebc65c..c064909329 100644
> > > --- a/builtin/rebase.c
> > > +++ b/builtin/rebase.c
> > > @@ -1592,8 +1592,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
> > >                               branch_name = options.head_name;
> > >
> > >               } else {
> > > -                     free(options.head_name);
> > > -                     options.head_name = NULL;
> > > +                     FREE_AND_NULL(options.head_name);
> > >                       branch_name = "HEAD";
> > >               }
> > >               if (get_oid("HEAD", &options.orig_head))
> > > @@ -1793,7 +1792,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
> > >        * we just fast-forwarded.
> > >        */
> > >       strbuf_reset(&msg);
> > > -     if (!oidcmp(&merge_base, &options.orig_head)) {
> > > +     if (oideq(&merge_base, &options.orig_head)) {
> > >               printf(_("Fast-forwarded %s to %s.\n"),
> > >                       branch_name, options.onto_name);
> > >               strbuf_addf(&msg, "rebase finished: %s onto %s",
> >
> > You are already using Coccinelle v1.0.7, aren't you?
> 
> No it's 1.0.5.

Oh, you are right, Coccinelle 1.0.5 does indeed find these.

When I saw that the self-built 1.0.7 found something that the
distro-shipped 1.0.4 didn't, I checked it with a self-built 1.0.6, and
as it didn't find these, either, I didn't bother with 1.0.5.  It seems
that it got fixed 1.0.5, then regressed in 1.0.6, to be fixed again in
1.0.7.

> I guess I should upgrade then.

I found 'make coccicheck' with 1.0.7 to be about 10-15% faster than
previous versions.