summaryrefslogtreecommitdiffstats
path: root/lib/libc/xdr/xdr_reference.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/xdr/xdr_reference.c')
-rw-r--r--lib/libc/xdr/xdr_reference.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/lib/libc/xdr/xdr_reference.c b/lib/libc/xdr/xdr_reference.c
index b0cdbce..60e7020 100644
--- a/lib/libc/xdr/xdr_reference.c
+++ b/lib/libc/xdr/xdr_reference.c
@@ -1,3 +1,5 @@
+/* $NetBSD: xdr_reference.c,v 1.13 2000/01/22 22:19:18 mycroft Exp $
+
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@@ -27,7 +29,8 @@
* Mountain View, California 94043
*/
-#if defined(LIBC_SCCS) && !defined(lint)
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)xdr_reference.c 1.11 87/08/11 SMI";*/
/*static char *sccsid = "from: @(#)xdr_reference.c 2.1 88/07/29 4.0 RPCSRC";*/
static char *rcsid = "$FreeBSD$";
@@ -42,13 +45,15 @@ static char *rcsid = "$FreeBSD$";
* "pointers". See xdr.h for more info on the interface to xdr.
*/
+#include "namespace.h"
+#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+
#include <rpc/types.h>
#include <rpc/xdr.h>
-
-#define LASTUNSIGNED ((u_int) 0-1)
+#include "libc_private.h"
/*
* XDR an indirect pointer
@@ -61,13 +66,13 @@ static char *rcsid = "$FreeBSD$";
*/
bool_t
xdr_reference(xdrs, pp, size, proc)
- register XDR *xdrs;
+ XDR *xdrs;
caddr_t *pp; /* the pointer to work on */
u_int size; /* size of the object pointed to */
xdrproc_t proc; /* xdr routine to handle the object */
{
- register caddr_t loc = *pp;
- register bool_t stat;
+ caddr_t loc = *pp;
+ bool_t stat;
if (loc == NULL)
switch (xdrs->x_op) {
@@ -77,15 +82,17 @@ xdr_reference(xdrs, pp, size, proc)
case XDR_DECODE:
*pp = loc = (caddr_t) mem_alloc(size);
if (loc == NULL) {
- (void) fprintf(stderr,
- "xdr_reference: out of memory\n");
+ warnx("xdr_reference: out of memory");
return (FALSE);
}
- memset(loc, 0, (int)size);
+ memset(loc, 0, size);
break;
- }
- stat = (*proc)(xdrs, loc, LASTUNSIGNED);
+ case XDR_ENCODE:
+ break;
+ }
+
+ stat = (*proc)(xdrs, loc);
if (xdrs->x_op == XDR_FREE) {
mem_free(loc, size);
@@ -116,7 +123,7 @@ xdr_reference(xdrs, pp, size, proc)
*/
bool_t
xdr_pointer(xdrs,objpp,obj_size,xdr_obj)
- register XDR *xdrs;
+ XDR *xdrs;
char **objpp;
u_int obj_size;
xdrproc_t xdr_obj;
OpenPOWER on IntegriCloud