Replace all internal uses of __bzero with memset. This removes the need
authorWilco Dijkstra <wdijkstr@arm.com>
Mon, 12 Jun 2017 13:56:53 +0000 (14:56 +0100)
committerWilco Dijkstra <wdijkstr@arm.com>
Mon, 12 Jun 2017 13:56:53 +0000 (14:56 +0100)
to redirect it to a builtin and means memset is inlined whenever possible,
including with -Os.

* sunrpc/bindrsvprt.c (bindresvport): Change __bzero to memset.
* sunrpc/clnt_gen.c (clnt_create): Likewise.
* sunrpc/des_impl.c (_des_crypt): Likewise.
* sunrpc/key_call.c (key_gendes): Likewise.
* sunrpc/pmap_rmt.c (clnt_broadcast): Likewise.
* sunrpc/svc_simple.c (universal): Likewise.
* sunrpc/svc_tcp.c (svctcp_create): Likewise.
* sunrpc/svc_udp.c (svcudp_bufcreate): Likewise.
* sysdeps/arm/aeabi_memclr.c (__aeabi_memclr): Likewise.

ChangeLog
sunrpc/bindrsvprt.c
sunrpc/clnt_gen.c
sunrpc/des_impl.c
sunrpc/key_call.c
sunrpc/pmap_rmt.c
sunrpc/svc_simple.c
sunrpc/svc_tcp.c
sunrpc/svc_udp.c
sysdeps/arm/aeabi_memclr.c

index 1fb0008..c66785d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2017-06-12  Wilco Dijkstra  <wdijkstr@arm.com>
+
+       * sunrpc/bindrsvprt.c (bindresvport): Change __bzero to memset.
+       * sunrpc/clnt_gen.c (clnt_create): Likewise.
+       * sunrpc/des_impl.c (_des_crypt): Likewise.
+       * sunrpc/key_call.c (key_gendes): Likewise.
+       * sunrpc/pmap_rmt.c (clnt_broadcast): Likewise.
+       * sunrpc/svc_simple.c (universal): Likewise.
+       * sunrpc/svc_tcp.c (svctcp_create): Likewise.
+       * sunrpc/svc_udp.c (svcudp_bufcreate): Likewise.
+       * sysdeps/arm/aeabi_memclr.c (__aeabi_memclr): Likewise.
+
 2017-06-10  Zack Weinberg  <zackw@panix.com>
 
        * stdlib/errno.h: Correct an outdated comment.
index 13bcb27..da33c05 100644 (file)
@@ -61,7 +61,7 @@ bindresvport (int sd, struct sockaddr_in *sin)
   if (sin == (struct sockaddr_in *) 0)
     {
       sin = &myaddr;
-      __bzero (sin, sizeof (*sin));
+      memset (sin, 0, sizeof (*sin));
       sin->sin_family = AF_INET;
     }
   else if (sin->sin_family != AF_INET)
index 542f85d..13ced89 100644 (file)
@@ -57,7 +57,7 @@ clnt_create (const char *hostname, u_long prog, u_long vers,
 
   if (strcmp (proto, "unix") == 0)
     {
-      __bzero ((char *)&sun, sizeof (sun));
+      memset ((char *)&sun, 0, sizeof (sun));
       sun.sun_family = AF_UNIX;
       strcpy (sun.sun_path, hostname);
       sock = RPC_ANYSOCK;
index 1757dc1..da0b8ce 100644 (file)
@@ -590,7 +590,7 @@ _des_crypt (char *buf, unsigned len, struct desparams *desp)
     }
   tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0;
   tbuf[0] = tbuf[1] = 0;
-  __bzero (schedule, sizeof (schedule));
+  memset (schedule, 0, sizeof (schedule));
 
   return (1);
 }
index b871c04..4bd3d31 100644 (file)
@@ -219,7 +219,7 @@ key_gendes (des_block *key)
   sin.sin_family = AF_INET;
   sin.sin_port = 0;
   sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
-  __bzero (sin.sin_zero, sizeof (sin.sin_zero));
+  memset (sin.sin_zero, 0, sizeof (sin.sin_zero));
   socket = RPC_ANYSOCK;
   client = clntudp_bufcreate (&sin, (u_long) KEY_PROG, (u_long) KEY_VERS,
                              trytimeout, &socket, RPCSMALLMSGSIZE,
index c036d88..6d4ed72 100644 (file)
@@ -257,7 +257,7 @@ clnt_broadcast (/* program number */
   fd.fd = sock;
   fd.events = POLLIN;
   nets = getbroadcastnets (addrs, sizeof (addrs) / sizeof (addrs[0]));
-  __bzero ((char *) &baddr, sizeof (baddr));
+  memset ((char *) &baddr, 0, sizeof (baddr));
   baddr.sin_family = AF_INET;
   baddr.sin_port = htons (PMAPPORT);
   baddr.sin_addr.s_addr = htonl (INADDR_ANY);
index acc9b9d..f12ed31 100644 (file)
@@ -154,7 +154,7 @@ universal (struct svc_req *rqstp, SVCXPRT *transp_l)
     if (pl->p_prognum == prog && pl->p_procnum == proc)
       {
        /* decode arguments into a CLEAN buffer */
-       __bzero (xdrbuf, sizeof (xdrbuf));      /* required ! */
+       memset (xdrbuf, 0, sizeof (xdrbuf));    /* required ! */
        if (!svc_getargs (transp_l, pl->p_inproc, xdrbuf))
          {
            svcerr_decode (transp_l);
index fd9c1e8..de2d6a9 100644 (file)
@@ -167,7 +167,7 @@ svctcp_create (int sock, u_int sendsize, u_int recvsize)
        }
       madesock = TRUE;
     }
-  __bzero ((char *) &addr, sizeof (addr));
+  memset ((char *) &addr, 0, sizeof (addr));
   addr.sin_family = AF_INET;
   if (bindresvport (sock, &addr))
     {
index 1592bcc..54ec331 100644 (file)
@@ -138,7 +138,7 @@ svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz)
        }
       madesock = TRUE;
     }
-  __bzero ((char *) &addr, sizeof (addr));
+  memset ((char *) &addr, 0, sizeof (addr));
   addr.sin_family = AF_INET;
   if (bindresvport (sock, &addr))
     {
index 6687e49..03263ea 100644 (file)
 
 #include <string.h>
 
-/* Clear memory.  Can't alias to bzero because it's not defined in the
-   same translation unit.  */
+/* Set memory like memset, but different argument order and no return
+   value required.  Also only integer caller-saves may be used.  */
 void
 __aeabi_memclr (void *dest, size_t n)
 {
-  __bzero (dest, n);
+  memset (dest, 0, n);
 }
 
 /* Versions of the above which may assume memory alignment.  */