Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/include/rpc From trunk: add explicit int32 put/get macr...
details: https://anonhg.NetBSD.org/src/rev/8b9e7138a08e
branches: netbsd-1-5
changeset: 488516:8b9e7138a08e
user: fvdl <fvdl%NetBSD.org@localhost>
date: Fri Jul 14 16:46:33 2000 +0000
description:
>From trunk: add explicit int32 put/get macros (or inline functions).
diffstat:
include/rpc/xdr.h | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)
diffs (51 lines):
diff -r d8867cccd555 -r 8b9e7138a08e include/rpc/xdr.h
--- a/include/rpc/xdr.h Fri Jul 14 15:44:20 2000 +0000
+++ b/include/rpc/xdr.h Fri Jul 14 16:46:33 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xdr.h,v 1.17 2000/06/02 22:57:57 fvdl Exp $ */
+/* $NetBSD: xdr.h,v 1.17.2.1 2000/07/14 16:46:33 fvdl Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -154,6 +154,29 @@
#define xdr_putlong(xdrs, longp) \
(*(xdrs)->x_ops->x_putlong)(xdrs, longp)
+static __inline
+xdr_getint32(XDR *xdrs, int32_t *ip)
+{
+ long l;
+
+ if (!xdr_getlong(xdrs, &l))
+ return (FALSE);
+ *ip = (int32_t)l;
+ return (TRUE);
+}
+
+static __inline
+xdr_putint32(XDR *xdrs, int32_t *ip)
+{
+ long l;
+
+ l = (long)*ip;
+ return xdr_putlong(xdrs, &l);
+}
+
+#define XDR_GETINT32(xdrs, int32p) xdr_getint32(xdrs, int32p)
+#define XDR_PUTINT32(xdrs, int32p) xdr_putint32(xdrs, int32p)
+
#define XDR_GETBYTES(xdrs, addr, len) \
(*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
#define xdr_getbytes(xdrs, addr, len) \
@@ -232,6 +255,11 @@
* N.B. and frozen for all time: each data type here uses 4 bytes
* of external representation.
*/
+#define IXDR_GET_INT32(buf) ((int32_t)ntohl((u_int32_t)*(buf)++))
+#define IXDR_PUT_INT32(buf, v) (*(buf)++ =(int32_t)htonl((u_int32_t)v))
+#define IXDR_GET_U_INT32(buf) ((u_int32_t)IXDR_GET_INT32(buf))
+#define IXDR_PUT_U_INT32(buf, v) IXDR_PUT_INT32((buf), ((int32_t)(v)))
+
#define IXDR_GET_LONG(buf) ((long)ntohl((u_int32_t)*(buf)++))
#define IXDR_PUT_LONG(buf, v) (*(buf)++ =(int32_t)htonl((u_int32_t)v))
Home |
Main Index |
Thread Index |
Old Index