public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Namhyung Kim <namhyung@kernel.org>,
	Ramkumar Ramachandra <artagnon@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>, Jiri Olsa <jolsa@redhat.com>
Subject: Re: [PATCH 3/5] tools lib traceevent: use else-if cascade, not separate ifs
Date: Tue, 18 Mar 2014 11:18:11 -0300	[thread overview]
Message-ID: <20140318141811.GC3585@infradead.org> (raw)
In-Reply-To: <20140318093006.16517a08@gandalf.local.home>

Em Tue, Mar 18, 2014 at 09:30:06AM -0400, Steven Rostedt escreveu:
> 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.

No problem with that, if I had written that code, I'd prefer the gotos,
but that is kinda personal preference.

Yeah, I'd nack that patch as well, changes nothing.

- Arnaldo

  reply	other threads:[~2014-03-18 14:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-17 22:26 [PATCH 0/5] Squelch warnings emitted by 'perf test' Ramkumar Ramachandra
2014-03-17 22:26 ` [PATCH 1/5] MAINTAINERS: add tools/lib/traceevent/ to perf subsystem Ramkumar Ramachandra
2014-03-20 14:51   ` Steven Rostedt
2014-03-17 22:26 ` [PATCH 2/5] tools lib traceevent: handle the '->' operator Ramkumar Ramachandra
     [not found]   ` <87ha6wrl8h.fsf@sejong.aot.lge.com>
2014-03-18 14:12     ` Ramkumar Ramachandra
2014-03-18 14:18       ` Namhyung Kim
2014-03-18 15:15         ` Steven Rostedt
2014-03-17 22:26 ` [PATCH 3/5] tools lib traceevent: use else-if cascade, not separate ifs Ramkumar Ramachandra
     [not found]   ` <87d2hkrl32.fsf@sejong.aot.lge.com>
2014-03-18 13:10     ` Arnaldo Carvalho de Melo
2014-03-18 13:30       ` Steven Rostedt
2014-03-18 14:18         ` Arnaldo Carvalho de Melo [this message]
2014-03-17 22:26 ` [PATCH 4/5] tools lib traceevent: field_is_long() includes unsigned long Ramkumar Ramachandra
2014-03-17 22:26 ` [PATCH 5/5] perf test: squelch warnings about undefined sizeof Ramkumar Ramachandra
     [not found]   ` <878us8rkqq.fsf@sejong.aot.lge.com>
2014-03-18 13:23     ` Jiri Olsa
2014-03-18 14:26       ` Namhyung Kim
2014-03-18 16:40       ` Ramkumar Ramachandra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140318141811.GC3585@infradead.org \
    --to=acme@redhat.com \
    --cc=artagnon@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox