[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131216124051.GA3598@ghostprotocols.net>
Date: Mon, 16 Dec 2013 09:40:51 -0300
From: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Steven Rostedt <rostedt@...dmis.org>,
Frederic Weisbecker <fweisbec@...il.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Ingo Molnar <mingo@...nel.org>,
Namhyung Kim <namhyung.kim@....com>,
LKML <linux-kernel@...r.kernel.org>, Jiri Olsa <jolsa@...hat.com>
Subject: Re: [PATCH 13/14] tools lib traceevent: Get rid of die() in some
string conversion funcitons
Em Mon, Dec 16, 2013 at 01:49:11PM +0900, Namhyung Kim escreveu:
> On Fri, 13 Dec 2013 11:52:04 -0300, Arnaldo Carvalho de Melo wrote:
> > All the rest is ok, so its just the malloc + strcpy that remains to be
> > converted, do you want me to do it?
> Hmm.. did you mean like this?
> str = NULL;
> if (val)
> asprintf(&str, "TRUE");
> else
> asprintf(&str, "FALSE");
> return str;
More compact:
if (asprintf(&str, "%s", val ? "TRUE" : "FALSE") < 0)
// error handling path
At that point str already is set to NULL.
- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists