[coreboot] libpayload: Add -Os to the CFLAGS

Uwe Hermann uwe at hermann-uwe.de
Thu Mar 20 21:59:35 CET 2008


On Thu, Mar 20, 2008 at 06:08:13PM +0100, Peter Stuge wrote:
> On Thu, Mar 20, 2008 at 06:03:08PM +0100, Segher Boessenkool wrote:
> > > I'd try to reuse strncpy() so that any optimizations need to be done
> > > in as few places as possible.
> > >
> > > Save strlen() and just append the 0.
> > 
> > Just do strlen() + 1, heh.
> 
> Yes of course. :)

So is this ok?

-       return strncpy(d, s, strlen(s));
+       return strncpy(d, s, strlen(s) + 1);


> > Or do Uwe's thing (without the parentheses around d and s, and
> > with the loop body on a separate line, coding standards...) if
> > you are terribly worried about performance here.  Or just import
> > from some existing C library, no need to reinvent the wheel,
> > and some of these functions can be quite tricky to get right ;-)
> 
> Well the memcpy() from HelenOS seemed to be a bit optimized already
> so would be good to reuse it via strncpy().

Hm? strncpy doesn't call memcpy().


Uwe.
-- 
http://www.hermann-uwe.de  | http://www.holsham-traders.de
http://www.crazy-hacks.org | http://www.unmaintained-free-software.org




More information about the coreboot mailing list