aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilco Dijkstra <wdijkstr@arm.com>2017-06-12 14:56:53 +0100
committerWilco Dijkstra <wdijkstr@arm.com>2017-06-12 14:56:53 +0100
commitd99431e519fdeb16edb1222b77430ac9853a2334 (patch)
tree25fd7c2817fa801a8228a5936f150faada6802e8
parentb05eca0e1d96aecb25516287913c54bbb93d3d92 (diff)
downloadglibc-d99431e519fdeb16edb1222b77430ac9853a2334.zip
glibc-d99431e519fdeb16edb1222b77430ac9853a2334.tar.gz
glibc-d99431e519fdeb16edb1222b77430ac9853a2334.tar.bz2
Replace all internal uses of __bzero with memset. This removes the need
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.
-rw-r--r--ChangeLog12
-rw-r--r--sunrpc/bindrsvprt.c2
-rw-r--r--sunrpc/clnt_gen.c2
-rw-r--r--sunrpc/des_impl.c2
-rw-r--r--sunrpc/key_call.c2
-rw-r--r--sunrpc/pmap_rmt.c2
-rw-r--r--sunrpc/svc_simple.c2
-rw-r--r--sunrpc/svc_tcp.c2
-rw-r--r--sunrpc/svc_udp.c2
-rw-r--r--sysdeps/arm/aeabi_memclr.c6
10 files changed, 23 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 1fb0008..c66785d 100644
--- 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.
diff --git a/sunrpc/bindrsvprt.c b/sunrpc/bindrsvprt.c
index 13bcb27..da33c05 100644
--- a/sunrpc/bindrsvprt.c
+++ b/sunrpc/bindrsvprt.c
@@ -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)
diff --git a/sunrpc/clnt_gen.c b/sunrpc/clnt_gen.c
index 542f85d..13ced89 100644
--- a/sunrpc/clnt_gen.c
+++ b/sunrpc/clnt_gen.c
@@ -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;
diff --git a/sunrpc/des_impl.c b/sunrpc/des_impl.c
index 1757dc1..da0b8ce 100644
--- a/sunrpc/des_impl.c
+++ b/sunrpc/des_impl.c
@@ -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);
}
diff --git a/sunrpc/key_call.c b/sunrpc/key_call.c
index b871c04..4bd3d31 100644
--- a/sunrpc/key_call.c
+++ b/sunrpc/key_call.c
@@ -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,
diff --git a/sunrpc/pmap_rmt.c b/sunrpc/pmap_rmt.c
index c036d88..6d4ed72 100644
--- a/sunrpc/pmap_rmt.c
+++ b/sunrpc/pmap_rmt.c
@@ -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);
diff --git a/sunrpc/svc_simple.c b/sunrpc/svc_simple.c
index acc9b9d..f12ed31 100644
--- a/sunrpc/svc_simple.c
+++ b/sunrpc/svc_simple.c
@@ -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);
diff --git a/sunrpc/svc_tcp.c b/sunrpc/svc_tcp.c
index fd9c1e8..de2d6a9 100644
--- a/sunrpc/svc_tcp.c
+++ b/sunrpc/svc_tcp.c
@@ -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))
{
diff --git a/sunrpc/svc_udp.c b/sunrpc/svc_udp.c
index 1592bcc..54ec331 100644
--- a/sunrpc/svc_udp.c
+++ b/sunrpc/svc_udp.c
@@ -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))
{
diff --git a/sysdeps/arm/aeabi_memclr.c b/sysdeps/arm/aeabi_memclr.c
index 6687e49..03263ea 100644
--- a/sysdeps/arm/aeabi_memclr.c
+++ b/sysdeps/arm/aeabi_memclr.c
@@ -17,12 +17,12 @@
#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. */