libcrypt/md5.c: a few statics can be auto variables; strlen("const") is silly

Denys Vlasenko vda.linux at googlemail.com
Sat Jun 21 21:56:48 UTC 2008


On Monday 16 June 2008 22:45, Chris Metcalf wrote:
> On 6/12/2008 6:14 AM, Will Newton wrote:
> > > On Thu, Jun 12, 2008 at 8:08 AM, Denys Vlasenko
> > > <vda.linux at googlemail.com> wrote:
> >> >> This is the patch wich ONLY replaces strlen("const") with
> >> >> sizeof("const")-1. Let's check assembly, do we see strlen
> >> >> in original version?
> > >
> > > What compiler flags were used? It's possible to disable this
> > > optimization in gcc.
> > >
> > > Maybe replace strlen with __builtin_strlen?
> 
> uClibc is normally built with -fno-builtin, which will prevent the strlen()
> optimization.  Using __builtin_strlen() seems reasonable here.

sizeof("str")-1 is even more reasonable, as this leaves no doubt
that compiler will not emit strlen().
--
vda



More information about the uClibc mailing list