[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANg8OW+MSPmdnTKUuFk72Ef+nonw+BrfGXp=SYFqgA+Eq9-BqA@mail.gmail.com>
Date: Tue, 16 Oct 2012 02:05:58 +0300
From: Irina Tirdea <irina.tirdea@...il.com>
To: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc: Ingo Molnar <mingo@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
LKML <linux-kernel@...r.kernel.org>,
Paul Mackerras <paulus@...ba.org>,
David Ahern <dsahern@...il.com>,
Namhyung Kim <namhyung@...nel.org>,
Pekka Enberg <penberg@...nel.org>,
Jiri Olsa <jolsa@...hat.com>,
Irina Tirdea <irina.tirdea@...el.com>
Subject: Re: [PATCH v3 8/8] perf stat: implement --big-num grouping
>> +
>> + *gnumber = NULL;
>> + /* No grouping */
>> + if (thousands_sep == NULL || grouping == NULL ||
>> + *thousands_sep == '\0' || *grouping == CHAR_MAX || *grouping <= 0) {
>> + *gnumber = strdup(number);
>> + if (*gnumber == NULL)
>> + ret = -ENOMEM;
>> + goto out;
>
> Humm, so we bail out unconditionally? :-)
>
> this should be:
>
> if (*gnumber == NULL)
> goto out;
>> + }
The initial code was correct, although not clear. We bail out if there
is no grouping (the outer if), set gnumber to a copy of number and
return success. If we cannot allocate a copy of gnumber then we return
the error code.
However, this is no longer needed since it is already done when we
call the grouping function. So I'll just return error in case there is
no grouping and the calling code will take care to use the original
number (with no grouping).
I'll also fix your other comments and submit a new version.
Thanks,
Irina
--
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