Re: [PATCH] powertop: possible a bug entered

Maksym Kryzhanovskyy xmaks at email.cz
Fri Nov 5 08:31:10 UTC 2010


> 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. 


Max
> 
> 
> -- 
> vda
> 
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: busybox.powertop.patch
Type: text/x-patch
Size: 1751 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20101105/53590169/attachment.bin>


More information about the busybox mailing list