#include <afsconfig.h>
#include <afs/param.h>
-RCSID("$Header$");
+RCSID
+ ("$Header$");
#ifndef NeXT
xdrproc_t elproc; * xdr routine to handle each element *
*/
-bool_t xdr_array(register XDR *xdrs, caddr_t *addrp, u_int *sizep,
- u_int maxsize, u_int elsize, xdrproc_t elproc)
+bool_t
+xdr_array(register XDR * xdrs, caddr_t * addrp, u_int * sizep, u_int maxsize,
+ u_int elsize, xdrproc_t elproc)
{
- register u_int i;
- register caddr_t target = *addrp;
- register u_int c; /* the actual element count */
- register bool_t stat = TRUE;
- register u_int nodesize;
+ register u_int i;
+ register caddr_t target = *addrp;
+ register u_int c; /* the actual element count */
+ register bool_t stat = TRUE;
+ register u_int nodesize;
- i = ((~0) >> 1) / elsize;
- if (maxsize > i) maxsize = i;
+ i = ((~0) >> 1) / elsize;
+ if (maxsize > i)
+ maxsize = i;
- /* like strings, arrays are really counted arrays */
- if (! xdr_u_int(xdrs, sizep)) {
- return (FALSE);
- }
- c = *sizep;
- if ((c > maxsize) && (xdrs->x_op != XDR_FREE)) {
- return (FALSE);
- }
- nodesize = c * elsize;
+ /* like strings, arrays are really counted arrays */
+ if (!xdr_u_int(xdrs, sizep)) {
+ return (FALSE);
+ }
+ c = *sizep;
+ if ((c > maxsize) && (xdrs->x_op != XDR_FREE)) {
+ return (FALSE);
+ }
+ nodesize = c * elsize;
- /*
- * if we are deserializing, we may need to allocate an array.
- * We also save time by checking for a null array if we are freeing.
- */
- if (target == NULL)
- switch (xdrs->x_op) {
- case XDR_DECODE:
- if (c == 0)
- return (TRUE);
- *addrp = target = osi_alloc(nodesize);
- if (target == NULL) {
- return (FALSE);
- }
- memset(target, 0, (u_int)nodesize);
- break;
+ /*
+ * if we are deserializing, we may need to allocate an array.
+ * We also save time by checking for a null array if we are freeing.
+ */
+ if (target == NULL)
+ switch (xdrs->x_op) {
+ case XDR_DECODE:
+ if (c == 0)
+ return (TRUE);
+ *addrp = target = osi_alloc(nodesize);
+ if (target == NULL) {
+ return (FALSE);
+ }
+ memset(target, 0, (u_int) nodesize);
+ break;
- case XDR_FREE:
- return (TRUE);
- }
-
- /*
- * now we xdr each element of array
- */
- for (i = 0; (i < c) && stat; i++) {
- stat = (*elproc)(xdrs, target, LASTUNSIGNED);
- target += elsize;
+ case XDR_FREE:
+ return (TRUE);
}
- /*
- * the array may need freeing
- */
- if (xdrs->x_op == XDR_FREE) {
- osi_free(*addrp, nodesize);
- *addrp = NULL;
- }
- return (stat);
+ /*
+ * now we xdr each element of array
+ */
+ for (i = 0; (i < c) && stat; i++) {
+ stat = (*elproc) (xdrs, target, LASTUNSIGNED);
+ target += elsize;
+ }
+
+ /*
+ * the array may need freeing
+ */
+ if (xdrs->x_op == XDR_FREE) {
+ osi_free(*addrp, nodesize);
+ *addrp = NULL;
+ }
+ return (stat);
}
#endif /* NeXT */