Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Jun 2016 19:44:47 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r301754 - head/lib/libc/rpc
Message-ID:  <201606091944.u59Jilxs020234@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Thu Jun  9 19:44:47 2016
New Revision: 301754
URL: https://svnweb.freebsd.org/changeset/base/301754

Log:
  libc/rpc: Make use of some xdr_* macros.
  
  xdr_rpcprog and xdr_rpcvers were broken in older versions of FreeBSD
  but were fixed in r296394. Give them some use hoping they help make
  the code somewhat more readable.

Modified:
  head/lib/libc/rpc/rpc_prot.c
  head/lib/libc/rpc/rpcb_prot.c

Modified: head/lib/libc/rpc/rpc_prot.c
==============================================================================
--- head/lib/libc/rpc/rpc_prot.c	Thu Jun  9 19:12:51 2016	(r301753)
+++ head/lib/libc/rpc/rpc_prot.c	Thu Jun  9 19:44:47 2016	(r301754)
@@ -217,8 +217,8 @@ xdr_callhdr(XDR *xdrs, struct rpc_msg *c
 	    (xdrs->x_op == XDR_ENCODE) &&
 	    xdr_u_int32_t(xdrs, &(cmsg->rm_xid)) &&
 	    xdr_enum(xdrs, (enum_t *) prm_direction) &&
-	    xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
-	    xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_prog)) )
+	    xdr_rpcvers(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
+	    xdr_rpcprog(xdrs, &(cmsg->rm_call.cb_prog)) )
 		return (xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_vers)));
 	return (FALSE);
 }

Modified: head/lib/libc/rpc/rpcb_prot.c
==============================================================================
--- head/lib/libc/rpc/rpcb_prot.c	Thu Jun  9 19:12:51 2016	(r301753)
+++ head/lib/libc/rpc/rpcb_prot.c	Thu Jun  9 19:44:47 2016	(r301754)
@@ -56,10 +56,10 @@ __FBSDID("$FreeBSD$");
 bool_t
 xdr_rpcb(XDR *xdrs, RPCB *objp)
 {
-	if (!xdr_u_int32_t(xdrs, &objp->r_prog)) {
+	if (!xdr_rpcprog(xdrs, &objp->r_prog)) {
 		return (FALSE);
 	}
-	if (!xdr_u_int32_t(xdrs, &objp->r_vers)) {
+	if (!xdr_rpcvers(xdrs, &objp->r_vers)) {
 		return (FALSE);
 	}
 	if (!xdr_string(xdrs, &objp->r_netid, (u_int)~0)) {
@@ -243,13 +243,13 @@ xdr_rpcb_rmtcallargs(XDR *xdrs, struct r
 
 	buf = XDR_INLINE(xdrs, 3 * BYTES_PER_XDR_UNIT);
 	if (buf == NULL) {
-		if (!xdr_u_int32_t(xdrs, &objp->prog)) {
+		if (!xdr_rpcprog(xdrs, &objp->prog)) {
 			return (FALSE);
 		}
-		if (!xdr_u_int32_t(xdrs, &objp->vers)) {
+		if (!xdr_rpcvers(xdrs, &objp->vers)) {
 			return (FALSE);
 		}
-		if (!xdr_u_int32_t(xdrs, &objp->proc)) {
+		if (!xdr_rpcproc(xdrs, &objp->proc)) {
 			return (FALSE);
 		}
 	} else {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606091944.u59Jilxs020234>