lkml.org 
[lkml]   [2014]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/5] tools lib traceevent: use else-if cascade, not separate ifs
On Tue, 18 Mar 2014 10:10:48 -0300
Arnaldo Carvalho de Melo <acme@redhat.com> wrote:

> Em Tue, Mar 18, 2014 at 05:02:09PM +0900, Namhyung Kim escreveu:
> > On Mon, 17 Mar 2014 18:26:36 -0400, Ramkumar Ramachandra wrote:
> > > When token cannot be more than one value, it seems wasteful to go
> > > through all the strcmp() calls. Use an else-if cascade instead.
> >
> > I think the end result will be same since it returns from inside the
> > block, right?
>
> Exactly :-)
>
> We could have it changed to something like:
>
> if (strcmp()) {
> ret = bla();
> goto out_free_token;
> }
> .
> .
> .
> out_free_token:
> free_token(token);
> return ret;
>
>

Honestly, I prefer the original, thus I would add a NAK to this patch.

-- Steve


\
 
 \ /
  Last update: 2014-03-18 16:01    [W:0.045 / U:1.704 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site