aboutsummaryrefslogtreecommitdiff
path: root/sunrpc
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-07-01 22:16:41 +0000
committerRoland McGrath <roland@gnu.org>1996-07-01 22:16:41 +0000
commit3776d592f117c8c5b0d2c37d265cb8ee2ac21695 (patch)
tree9cae15e988bc6b4eb1e2737db59bceaab58e0be7 /sunrpc
parent7cbc698400bfe2a64f12b0cb703fda0fdecb5a59 (diff)
downloadglibc-3776d592f117c8c5b0d2c37d265cb8ee2ac21695.zip
glibc-3776d592f117c8c5b0d2c37d265cb8ee2ac21695.tar.gz
glibc-3776d592f117c8c5b0d2c37d265cb8ee2ac21695.tar.bz2
Mon Jul 1 12:29:50 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* nss/Makefile (databases): Change host to hosts. * nss/host-lookup.c: Renamed to nss/hosts-lookup.c.
Diffstat (limited to 'sunrpc')
-rw-r--r--sunrpc/xdr.c93
1 files changed, 41 insertions, 52 deletions
diff --git a/sunrpc/xdr.c b/sunrpc/xdr.c
index a5241a5..a5b5e68 100644
--- a/sunrpc/xdr.c
+++ b/sunrpc/xdr.c
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)xdr.c 1.35 87/08/12";
*/
#include <stdio.h>
+#include <limits.h>
char *malloc();
#include <rpc/types.h>
@@ -99,34 +100,28 @@ xdr_int(xdrs, ip)
(void) (xdr_short(xdrs, (short *)ip));
return (xdr_long(xdrs, (long *)ip));
#else
- if (sizeof (int) < sizeof (long)) {
- long l;
-
- switch (xdrs->x_op) {
- case XDR_ENCODE:
- l = (long) *ip;
- return XDR_PUTLONG(xdrs, &l);
-
- case XDR_DECODE:
- if (!XDR_GETLONG(xdrs, &l)) {
- return FALSE;
- }
- *ip = (int) l;
- return TRUE;
- }
- } else if (sizeof (int) == sizeof (long)) {
- return (xdr_long(xdrs, (long *)ip));
- } else if (sizeof (int) == sizeof (short)) {
- return (xdr_short(xdrs, (short *)ip));
- } else {
- abort (); /* roland@gnu */
-#if 0
- /* force unresolved reference (link-time error): */
- extern unexpected_sizes_in_xdr_int ();
+# if INT_MAX < LONG_MAX
+ long l;
- unexpected_sizes_in_xdr_int();
-#endif
+ switch (xdrs->x_op) {
+ case XDR_ENCODE:
+ l = (long) *ip;
+ return XDR_PUTLONG(xdrs, &l);
+
+ case XDR_DECODE:
+ if (!XDR_GETLONG(xdrs, &l)) {
+ return FALSE;
+ }
+ *ip = (int) l;
+ return TRUE;
}
+# elif INT_MAX == LONG_MAX
+ return xdr_long(xdrs, (long *)ip);
+# elif INT_MAX == SHRT_MAX
+ return xdr_short(xdrs, (short *)ip);
+# else
+# error unexpected integer sizes in_xdr_int()
+# endif
#endif
}
@@ -142,34 +137,28 @@ xdr_u_int(xdrs, up)
(void) (xdr_short(xdrs, (short *)up));
return (xdr_u_long(xdrs, (u_long *)up));
#else
- if (sizeof (u_int) < sizeof (u_long)) {
- u_long l;
-
- switch (xdrs->x_op) {
- case XDR_ENCODE:
- l = (u_long) *up;
- return XDR_PUTLONG(xdrs, &l);
-
- case XDR_DECODE:
- if (!XDR_GETLONG(xdrs, &l)) {
- return FALSE;
- }
- *up = (u_int) l;
- return TRUE;
- }
- } else if (sizeof (u_int) == sizeof (u_long)) {
- return (xdr_u_long(xdrs, (u_long *)up));
- } else if (sizeof (u_int) == sizeof (u_short)) {
- return (xdr_short(xdrs, (short *)up));
- } else {
- abort (); /* drepper@gnu */
-#if 0
- /* force unresolved reference (link-time error): */
- extern unexpected_sizes_in_xdr_u_int ();
+# if UINT_MAX < ULONG_MAX
+ u_long l;
- unexpected_sizes_in_xdr_u_int();
-#endif
+ switch (xdrs->x_op) {
+ case XDR_ENCODE:
+ l = (u_long) *up;
+ return XDR_PUTLONG(xdrs, &l);
+
+ case XDR_DECODE:
+ if (!XDR_GETLONG(xdrs, &l)) {
+ return FALSE;
+ }
+ *up = (u_int) l;
+ return TRUE;
}
+# elif UINT_MAX == ULONG_MAX
+ return xdr_u_long(xdrs, (u_long *)up);
+# elif UINT_MAX == USHRT_MAX
+ return xdr_short(xdrs, (short *)up);
+# else
+# error unexpected integer sizes in_xdr_u_int()
+# endif
#endif
}