lkml.org 
[lkml]   [2012]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [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


\
 
 \ /
  Last update: 2012-10-16 01:41    [W:0.056 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site