[flashrom] [PATCH] Use strlen for const strings

David Borg borg.db at gmail.com
Fri Oct 15 14:06:16 CEST 2010


Carl-Daniel, please run 'svn up' in the source directory before committing,
as the patch won't apply directly as-is. svn will handle the merge
correctly.
Thanks!

On 15 October 2010 01:47, Sean Nelson <audiohacked at gmail.com> wrote:

>  On 9/29/10 5:41 PM, Carl-Daniel Hailfinger wrote:
>
>> Replace sizeof("string")-1 with strlen("string")
>>
>> We want to avoid calls to strlen at runtime if the string is already
>> known at compile time.
>> Turns out that gcc and clang will recognize constant strings and compute
>> the strlen result already at compile time, so trickery with sizeof only
>> reduces readability but does not improve the code.
>>
>> Signed-off-by: Carl-Daniel Hailfinger<c-d.hailfinger.devel.2006 at gmx.net>
>>
> Acked-by: Sean Nelson <audiohacked at gmail.com>
>
>
>
> _______________________________________________
> flashrom mailing list
> flashrom at flashrom.org
> http://www.flashrom.org/mailman/listinfo/flashrom
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.flashrom.org/pipermail/flashrom/attachments/20101015/f1dd1fe4/attachment.html>


More information about the flashrom mailing list