summaryrefslogtreecommitdiff
path: root/include/rpc/xdr.h
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2005-05-02 13:49:28 +0000
committerManuel Novoa III <mjn3@codepoet.org>2005-05-02 13:49:28 +0000
commitb40d807317e1641489eb77f0203e987d517dada4 (patch)
treefc39e87d5258b7ca1fa2ead1da52000d21802b1a /include/rpc/xdr.h
parent2ef9f5cf617c07e2488382e95e7567610dab7e0e (diff)
Replace IXDR_GET_LONG/IXDR_PUT_LONG so that they build with newer gcc. Note the comment in the code.
Diffstat (limited to 'include/rpc/xdr.h')
-rw-r--r--include/rpc/xdr.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h
index 6eaf958bb..4b2bb0e97 100644
--- a/include/rpc/xdr.h
+++ b/include/rpc/xdr.h
@@ -273,10 +273,20 @@ struct xdr_discrim
* and shouldn't be used any longer. Code which use this defines or longs
* in the RPC code will not work on 64bit Solaris platforms !
*/
+/* #define IXDR_GET_LONG(buf) \ */
+/* ((long)ntohl((u_long)*(*(u_int32_t**)&(buf))++)) */
+/* #define IXDR_PUT_LONG(buf, v) \ */
+/* (*(*(u_int32_t**)&(buf))++ = (long)htonl((u_long)(v))) */
+
+/* WARNING: These macros are not safe against side effects for the 'buf'
+ * argument. But the old versions they're replacing took the address of
+ * 'buf' and were probably not safe in that situation either. */
#define IXDR_GET_LONG(buf) \
- ((long)ntohl((u_long)*(*(u_int32_t**)&(buf))++))
+ ((long) ntohl((u_long) (((u_int32_t *)(buf = (void *)(((char *) buf) + sizeof(u_int32_t))))[-1]) ))
#define IXDR_PUT_LONG(buf, v) \
- (*(*(u_int32_t**)&(buf))++ = (long)htonl((u_long)(v)))
+ (((u_int32_t *)(buf = (void *)(((char *) buf) + sizeof(u_int32_t))))[-1]) = (long)htonl((u_long)(v))
+
+
#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf))
#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG(buf, (long)(v))