Add XDR support (only built #if cygwin, for now)

Charles Wilson cygwin@cwilson.fastmail.fm
Sat Feb 27 01:01:00 GMT 2010


Charles Wilson wrote:
> The attached patch(es) add XDR support to newlib. eXternal Data

This update is in response to the previous discussion.  It is presented
as patch, to be applied "on top of" the original patch (but I didn't
include ripple to Makefile.in).  Changes:

include/rpc/types.h: guard quad_t/u_quad_t typedef with
___int64_t_defined, and check for mem_alloc/mem_free (pre)definition
before defining.

include/rpc/xdr.h: don't include stdio.h.  Guard functions related to
64bit integral types with ___int64_t_defined. Guard xdrstdio_create()
with _STDIO_H_.  (Did NOT guard the declaration of xdr_double() using
_DOUBLE_IS_32BIT; on those platforms we'll get a linker error rather
than a compile error if you try to use xdr_double).

xdr/README: New file.

xdr/xdr_float.c: refactor all vax-related code to xdr_float_vax.c. Guard
all code using the following structure:
   #if defined(__IEEE_LITTLE_ENDIAN) || defined(__IEEE_BIG_ENDIAN)
   ... everything ...
   #elif defined(__vax__)
   #include "xdr_float_vax.c"
   #endif
for easier future extension. Don't include stdio.h.  Use
__IEEE_BIG_ENDIAN/__IEEE_LITTLE_ENDIAN instead of BYTEORDER and IEEEFP.
Don't implement xdr_double() if _DOUBLE_IS_32BIT.

xdr/xdr_float_vax.c: New file. Don't implement xdr_double() if
_DOUBLE_IS_32BIT.


xdr/Makefile.am: Only build xdr_stdio.c if stdio is supported (use
HAVE_STDIO_DIR AM_CONDITIONAL).  Add xdr_float_vax.c and README to
EXTRA_DIST.


xdr/xdr.c: Don't include stdio.h.  Do include errno.h.  Make sure to set
errno on out-of-memory.  Guard functions related to 64bit integral types
with ___int64_t_defined.

xdr/xdr_array.c: Don't include stdio.h.  Do include errno.h.  Make sure
to set errno on out-of-memory.

xdr/xdr_private.c: Don't include stdio.h.  In xdr_vwarnx, don't do
anything if the function pointer is null.

xdr/xdr_private.h: Don't include stdio.h.  Copy definition of __VALIST
from stdio.h.

xdr/xdr_rec.c: Don't include stdio.h.  Do include errno.h.  Make sure to
set errno on out-of-memory.

xdr/xdr_reference.c: Don't include stdio.h.  Do include errno.h.  Make
sure to set errno on out-of-memory.

xdr/xdr_sizeof.c: Use mem_free and mem_alloc instead of free() and malloc().

--
Chuck
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xdr-header-changes.patch
Type: text/x-patch
Size: 2597 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20100227/bb45e9c9/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xdr-impl-changes.patch
Type: text/x-patch
Size: 30443 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20100227/bb45e9c9/attachment-0001.bin>


More information about the Newlib mailing list