On Tue, 8 Oct 2013 01:33:07 +0900
Daniel Juyung Seo <seojuyu...@gmail.com> wrote:

> You're right.
> There are 40 instances of "if (xx) free(xx);" in elementary.
> I can clean them up as well :)
> My latest hobby is to clean up codes. It's just annoying.
> 
> Daniel Juyung Seo (SeoZ)
> 
> 
> On Tue, Oct 8, 2013 at 12:19 AM, Michael Blumenkrantz <
> michael.blumenkra...@gmail.com> wrote:
> 
> > the more important thing to note is that free(NULL) is a totally valid
> > no-op, but for some reason people keep if() checking it...
> >
> > On Mon, 07 Oct 2013 08:08:08 -0700
> > Daniel Juyung Seo <seojuyu...@gmail.com> wrote:
> >
> > > seoz pushed a commit to branch master.
> > >
> > >
> > http://git.enlightenment.org/core/elementary.git/commit/?id=ea7087c3ad6d24341159602dc95829daa0fa5557
> > >
> > > commit ea7087c3ad6d24341159602dc95829daa0fa5557
> > > Author: Daniel Juyung Seo <seojuyu...@gmail.com>
> > > Date:   Tue Oct 8 00:08:19 2013 +0900
> > >
> > >     elm_cnp.c: Did a subtle code cleanup.
> > >
> > >     savedtypes.imgfile should not be null logically or this function
> > should have been returned in advance.
> > > ---
> > >  src/lib/elm_cnp.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
> > > index 97696a4..5d02dcc 100644
> > > --- a/src/lib/elm_cnp.c
> > > +++ b/src/lib/elm_cnp.c
> > > @@ -2775,7 +2775,7 @@ _wl_dropable_data_handle(Wl_Cnp_Selection *sel,
> > char *data)
> > >          sdata.data = entrytag;
> > >          drop->dropcb(drop->cbdata, drop->obj, &sdata);
> > >          ecore_wl_dnd_drag_end(ecore_wl_input_get());
> > > -        if (savedtypes.imgfile) free(savedtypes.imgfile);
> > > +        free(savedtypes.imgfile);
> > >          savedtypes.imgfile = NULL;
> > >       }
> > >     else if (drop->types & ELM_SEL_FORMAT_IMAGE)
> > > @@ -2784,7 +2784,7 @@ _wl_dropable_data_handle(Wl_Cnp_Selection *sel,
> > char *data)
> > >          sdata.data = (char *)savedtypes.imgfile;
> > >          drop->dropcb(drop->cbdata, drop->obj, &sdata);
> > >          ecore_wl_dnd_drag_end(ecore_wl_input_get());
> > > -        if (savedtypes.imgfile) free(savedtypes.imgfile);
> > > +        free(savedtypes.imgfile);
> > >          savedtypes.imgfile = NULL;
> > >       }
> > >  }
> > >
> >
> >


coccinelle would be the better choice here

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to