[PATCH] Reduce code size of _REENT_INIT_PTR()

Eric Blake eblake@redhat.com
Fri Apr 26 10:29:00 GMT 2013


On 04/26/2013 02:43 AM, Sebastian Huber wrote:
> Use one memset() to initialize everything to zero.  Set non-zero fields
> in a second step.  There is only a small runtime overhead, but the code
> size is greatly reduced.  This change assumes the NULL pointer and '\0'
> are encoded as zero bits.

'\0' is required to be all zero bits by C99; no assumption required.
NULL is allowed to be encoded as non-zero bits, but such systems are
extremely rare, and I don't know of any newlib target that violates the
assumption (that is, we have other code in newlib that assumes a memset
to 0 correctly initializes null pointer values).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/newlib/attachments/20130426/21ee3f10/attachment.sig>


More information about the Newlib mailing list