[PATCH] powertop: possible a bug entered
Denys Vlasenko
vda.linux at googlemail.com
Sat Nov 6 00:56:56 UTC 2010
On Fri, Nov 5, 2010 at 9:31 AM, Maksym Kryzhanovskyy <xmaks at email.cz> wrote:
>> On Thursday 04 November 2010 10:50, Maksym Kryzhanovskyy wrote:
>> > It seems that we need '\0' immediately after " total events" in the buf,
>> > otherwise strcmp does not match. See attachment.
>>
>> Yes, indeed... do you think this simple fix is enough? -
>>
>> count = skip_whitespace(buf);
>> - if (strcmp(strchrnul(count, ' '), " total events") ==
>> 0)
>> - break;
>> p = strchr(count, ',');
>> if (!p)
>> continue;
>> *p++ = '\0';
>> + if (strcmp(skip_non_whitespace(count), " total events")
>> == 0)
>> + break;
>>
>
> Sure, and one more thing. Why we test " total events" twice when we can once?
> Attached is an another "total_events" optimization, it will save 40 bytes now.
> Please review and consider usage.
Applied, thanks!
--
vda
More information about the busybox
mailing list