]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sunrpc/xdr.c
S390: Increase function alignment to 16 bytes.
[thirdparty/glibc.git] / sunrpc / xdr.c
index d8e782eddb5a6e9235dc99be5f28f149d856e23e..b5fb7455e2822cec344ebdc50a0f44667fbae615 100644 (file)
 #include <limits.h>
 #include <string.h>
 #include <libintl.h>
+#include <wchar.h>
+#include <stdint.h>
 
 #include <rpc/types.h>
 #include <rpc/xdr.h>
+#include <shlib-compat.h>
 
-#ifdef USE_IN_LIBIO
-# include <wchar.h>
-#endif
 
 /*
  * constants specific to the xdr "protocol"
@@ -71,6 +71,11 @@ xdr_free (xdrproc_t proc, char *objp)
   x.x_op = XDR_FREE;
   (*proc) (&x, objp);
 }
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_free)
+#else
+libc_hidden_nolink_sunrpc (xdr_free, GLIBC_2_0)
+#endif
 
 /*
  * XDR nothing
@@ -80,7 +85,11 @@ xdr_void (void)
 {
   return TRUE;
 }
-INTDEF(xdr_void)
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_void)
+#else
+libc_hidden_nolink_sunrpc (xdr_void, GLIBC_2_0)
+#endif
 
 /*
  * XDR integers
@@ -104,19 +113,24 @@ xdr_int (XDR *xdrs, int *ip)
          return FALSE;
        }
       *ip = (int) l;
+      /* Fall through.  */
     case XDR_FREE:
       return TRUE;
     }
   return FALSE;
 #elif INT_MAX == LONG_MAX
-  return INTUSE(xdr_long) (xdrs, (long *) ip);
+  return xdr_long (xdrs, (long *) ip);
 #elif INT_MAX == SHRT_MAX
-  return INTUSE(xdr_short) (xdrs, (short *) ip);
+  return xdr_short (xdrs, (short *) ip);
 #else
 #error unexpected integer sizes in_xdr_int()
 #endif
 }
-INTDEF(xdr_int)
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_int)
+#else
+libc_hidden_nolink_sunrpc (xdr_int, GLIBC_2_0)
+#endif
 
 /*
  * XDR unsigned integers
@@ -139,19 +153,24 @@ xdr_u_int (XDR *xdrs, u_int *up)
          return FALSE;
        }
       *up = (u_int) (u_long) l;
+      /* Fall through.  */
     case XDR_FREE:
       return TRUE;
     }
   return FALSE;
 #elif UINT_MAX == ULONG_MAX
-  return INTUSE(xdr_u_long) (xdrs, (u_long *) up);
+  return xdr_u_long (xdrs, (u_long *) up);
 #elif UINT_MAX == USHRT_MAX
-  return INTUSE(xdr_short) (xdrs, (short *) up);
+  return xdr_short (xdrs, (short *) up);
 #else
 #error unexpected integer sizes in_xdr_u_int()
 #endif
 }
-INTDEF(xdr_u_int)
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_u_int)
+#else
+libc_hidden_nolink_sunrpc (xdr_u_int, GLIBC_2_0)
+#endif
 
 /*
  * XDR long integers
@@ -175,7 +194,11 @@ xdr_long (XDR *xdrs, long *lp)
 
   return FALSE;
 }
-INTDEF(xdr_long)
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_long)
+#else
+libc_hidden_nolink_sunrpc (xdr_long, GLIBC_2_0)
+#endif
 
 /*
  * XDR unsigned long integers
@@ -210,7 +233,11 @@ xdr_u_long (XDR *xdrs, u_long *ulp)
     }
   return FALSE;
 }
-INTDEF(xdr_u_long)
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_u_long)
+#else
+libc_hidden_nolink_sunrpc (xdr_u_long, GLIBC_2_0)
+#endif
 
 /*
  * XDR hyper integers
@@ -242,8 +269,11 @@ xdr_hyper (XDR *xdrs, quad_t *llp)
 
   return FALSE;
 }
-INTDEF(xdr_hyper)
-
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_hyper)
+#else
+libc_hidden_nolink_sunrpc (xdr_hyper, GLIBC_2_1_1)
+#endif
 
 /*
  * XDR hyper integers
@@ -275,19 +305,33 @@ xdr_u_hyper (XDR *xdrs, u_quad_t *ullp)
 
   return FALSE;
 }
-INTDEF(xdr_u_hyper)
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_u_hyper)
+#else
+libc_hidden_nolink_sunrpc (xdr_u_hyper, GLIBC_2_1_1)
+#endif
 
 bool_t
 xdr_longlong_t (XDR *xdrs, quad_t *llp)
 {
-  return INTUSE(xdr_hyper) (xdrs, llp);
+  return xdr_hyper (xdrs, llp);
 }
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_longlong_t)
+#else
+libc_hidden_nolink_sunrpc (xdr_longlong_t, GLIBC_2_1_1)
+#endif
 
 bool_t
 xdr_u_longlong_t (XDR *xdrs, u_quad_t *ullp)
 {
-  return INTUSE(xdr_u_hyper) (xdrs, ullp);
+  return xdr_u_hyper (xdrs, ullp);
 }
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_u_longlong_t)
+#else
+libc_hidden_nolink_sunrpc (xdr_u_longlong_t, GLIBC_2_1_1)
+#endif
 
 /*
  * XDR short integers
@@ -316,7 +360,11 @@ xdr_short (XDR *xdrs, short *sp)
     }
   return FALSE;
 }
-INTDEF(xdr_short)
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_short)
+#else
+libc_hidden_nolink_sunrpc (xdr_short, GLIBC_2_0)
+#endif
 
 /*
  * XDR unsigned short integers
@@ -345,7 +393,11 @@ xdr_u_short (XDR *xdrs, u_short *usp)
     }
   return FALSE;
 }
-INTDEF(xdr_u_short)
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_u_short)
+#else
+libc_hidden_nolink_sunrpc (xdr_u_short, GLIBC_2_0)
+#endif
 
 
 /*
@@ -357,13 +409,18 @@ xdr_char (XDR *xdrs, char *cp)
   int i;
 
   i = (*cp);
-  if (!INTUSE(xdr_int) (xdrs, &i))
+  if (!xdr_int (xdrs, &i))
     {
       return FALSE;
     }
   *cp = i;
   return TRUE;
 }
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_char)
+#else
+libc_hidden_nolink_sunrpc (xdr_char, GLIBC_2_0)
+#endif
 
 /*
  * XDR an unsigned char
@@ -374,13 +431,18 @@ xdr_u_char (XDR *xdrs, u_char *cp)
   u_int u;
 
   u = (*cp);
-  if (!INTUSE(xdr_u_int) (xdrs, &u))
+  if (!xdr_u_int (xdrs, &u))
     {
       return FALSE;
     }
   *cp = u;
   return TRUE;
 }
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_u_char)
+#else
+libc_hidden_nolink_sunrpc (xdr_u_char, GLIBC_2_0)
+#endif
 
 /*
  * XDR booleans
@@ -409,7 +471,11 @@ xdr_bool (XDR *xdrs, bool_t *bp)
     }
   return FALSE;
 }
-INTDEF(xdr_bool)
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_bool)
+#else
+libc_hidden_nolink_sunrpc (xdr_bool, GLIBC_2_0)
+#endif
 
 /*
  * XDR enumerations
@@ -442,25 +508,30 @@ xdr_enum (XDR *xdrs, enum_t *ep)
              return FALSE;
            }
          *ep = l;
+         /* Fall through.  */
        case XDR_FREE:
          return TRUE;
 
        }
       return FALSE;
 #else
-      return INTUSE(xdr_long) (xdrs, (long *) ep);
+      return xdr_long (xdrs, (long *) ep);
 #endif
     }
   else if (sizeof (enum sizecheck) == sizeof (short))
     {
-      return INTUSE(xdr_short) (xdrs, (short *) ep);
+      return xdr_short (xdrs, (short *) ep);
     }
   else
     {
       return FALSE;
     }
 }
-INTDEF(xdr_enum)
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_enum)
+#else
+libc_hidden_nolink_sunrpc (xdr_enum, GLIBC_2_0)
+#endif
 
 /*
  * XDR opaque data
@@ -511,7 +582,11 @@ xdr_opaque (XDR *xdrs, caddr_t cp, u_int cnt)
     }
   return FALSE;
 }
-INTDEF(xdr_opaque)
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_opaque)
+#else
+libc_hidden_nolink_sunrpc (xdr_opaque, GLIBC_2_0)
+#endif
 
 /*
  * XDR counted bytes
@@ -519,11 +594,7 @@ INTDEF(xdr_opaque)
  * If *cpp is NULL maxsize bytes are allocated
  */
 bool_t
-xdr_bytes (xdrs, cpp, sizep, maxsize)
-     XDR *xdrs;
-     char **cpp;
-     u_int *sizep;
-     u_int maxsize;
+xdr_bytes (XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize)
 {
   char *sp = *cpp;     /* sp is the actual string pointer */
   u_int nodesize;
@@ -531,7 +602,7 @@ xdr_bytes (xdrs, cpp, sizep, maxsize)
   /*
    * first deal with the length since xdr bytes are counted
    */
-  if (!INTUSE(xdr_u_int) (xdrs, sizep))
+  if (!xdr_u_int (xdrs, sizep))
     {
       return FALSE;
     }
@@ -560,10 +631,10 @@ xdr_bytes (xdrs, cpp, sizep, maxsize)
          (void) __fxprintf (NULL, "%s: %s", __func__, _("out of memory\n"));
          return FALSE;
        }
-      /* fall into ... */
+      /* Fall through.  */
 
     case XDR_ENCODE:
-      return INTUSE(xdr_opaque) (xdrs, sp, nodesize);
+      return xdr_opaque (xdrs, sp, nodesize);
 
     case XDR_FREE:
       if (sp != NULL)
@@ -575,20 +646,26 @@ xdr_bytes (xdrs, cpp, sizep, maxsize)
     }
   return FALSE;
 }
-INTDEF(xdr_bytes)
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_bytes)
+#else
+libc_hidden_nolink_sunrpc (xdr_bytes, GLIBC_2_0)
+#endif
 
 /*
  * Implemented here due to commonality of the object.
  */
 bool_t
-xdr_netobj (xdrs, np)
-     XDR *xdrs;
-     struct netobj *np;
+xdr_netobj (XDR *xdrs, struct netobj *np)
 {
 
-  return INTUSE(xdr_bytes) (xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ);
+  return xdr_bytes (xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ);
 }
-INTDEF(xdr_netobj)
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_netobj)
+#else
+libc_hidden_nolink_sunrpc (xdr_netobj, GLIBC_2_0)
+#endif
 
 /*
  * XDR a discriminated union
@@ -602,19 +679,22 @@ INTDEF(xdr_netobj)
  * If there is no specific or default routine an error is returned.
  */
 bool_t
-xdr_union (xdrs, dscmp, unp, choices, dfault)
-     XDR *xdrs;
-     enum_t *dscmp;            /* enum to decide which arm to work on */
-     char *unp;                        /* the union itself */
-     const struct xdr_discrim *choices;        /* [value, xdr proc] for each arm */
-     xdrproc_t dfault;         /* default xdr routine */
+xdr_union (XDR *xdrs,
+          /* enum to decide which arm to work on */
+          enum_t *dscmp,
+          /* the union itself */
+          char *unp,
+          /* [value, xdr proc] for each arm */
+          const struct xdr_discrim *choices,
+          /* default xdr routine */
+          xdrproc_t dfault)
 {
   enum_t dscm;
 
   /*
    * we deal with the discriminator;  it's an enum
    */
-  if (!INTUSE(xdr_enum) (xdrs, dscmp))
+  if (!xdr_enum (xdrs, dscmp))
     {
       return FALSE;
     }
@@ -636,7 +716,7 @@ xdr_union (xdrs, dscmp, unp, choices, dfault)
   return ((dfault == NULL_xdrproc_t) ? FALSE :
          (*dfault) (xdrs, unp, LASTUNSIGNED));
 }
-INTDEF(xdr_union)
+libc_hidden_nolink_sunrpc (xdr_union, GLIBC_2_0)
 
 
 /*
@@ -654,13 +734,12 @@ INTDEF(xdr_union)
  * of the string as specified by a protocol.
  */
 bool_t
-xdr_string (xdrs, cpp, maxsize)
-     XDR *xdrs;
-     char **cpp;
-     u_int maxsize;
+xdr_string (XDR *xdrs, char **cpp, u_int maxsize)
 {
   char *sp = *cpp;     /* sp is the actual string pointer */
-  u_int size;
+  /* Initialize to silence the compiler.  It is not really needed because SIZE
+     never actually gets used without being initialized.  */
+  u_int size = 0;
   u_int nodesize;
 
   /*
@@ -682,7 +761,7 @@ xdr_string (xdrs, cpp, maxsize)
     case XDR_DECODE:
       break;
     }
-  if (!INTUSE(xdr_u_int) (xdrs, &size))
+  if (!xdr_u_int (xdrs, &size))
     {
       return FALSE;
     }
@@ -713,10 +792,10 @@ xdr_string (xdrs, cpp, maxsize)
          return FALSE;
        }
       sp[size] = 0;
-      /* fall into ... */
+      /* Fall through.  */
 
     case XDR_ENCODE:
-      return INTUSE(xdr_opaque) (xdrs, sp, size);
+      return xdr_opaque (xdrs, sp, size);
 
     case XDR_FREE:
       mem_free (sp, nodesize);
@@ -725,20 +804,27 @@ xdr_string (xdrs, cpp, maxsize)
     }
   return FALSE;
 }
-INTDEF(xdr_string)
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_string)
+#else
+libc_hidden_nolink_sunrpc (xdr_string, GLIBC_2_0)
+#endif
 
 /*
  * Wrapper for xdr_string that can be called directly from
  * routines like clnt_call
  */
 bool_t
-xdr_wrapstring (xdrs, cpp)
-     XDR *xdrs;
-     char **cpp;
+xdr_wrapstring (XDR *xdrs, char **cpp)
 {
-  if (INTUSE(xdr_string) (xdrs, cpp, LASTUNSIGNED))
+  if (xdr_string (xdrs, cpp, LASTUNSIGNED))
     {
       return TRUE;
     }
   return FALSE;
 }
+#ifdef EXPORT_RPC_SYMBOLS
+libc_hidden_def (xdr_wrapstring)
+#else
+libc_hidden_nolink_sunrpc (xdr_wrapstring, GLIBC_2_0)
+#endif