[coreboot] libpayload: Add -Os to the CFLAGS
Segher Boessenkool
segher at kernel.crashing.org
Thu Mar 20 22:40:17 CET 2008
> So is this ok?
>
> - return strncpy(d, s, strlen(s));
> + return strncpy(d, s, strlen(s) + 1);
It is okay, yes.
>> 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().
Hey, you could factor it into strlen() + memcpy() + memset() [*], if
you don't mind walking the string twice. You could use memcpy()
instead of strncpy() in your strcpy(), too, for a minor optimisation.
It's really not worth it if you ask me; an optimised memcpy() --
and, to a lesser degree, an optimised memset() -- might be noticeable,
but for the rest of these functions?
Segher
[*] Actually, you need strnlen(), but that's not a standard function.
More information about the coreboot
mailing list