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.
This commit is contained in:
Wilco Dijkstra 2017-06-12 14:56:53 +01:00
parent b05eca0e1d
commit d99431e519
10 changed files with 23 additions and 11 deletions

View File

@ -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.

View 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)

View 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;

View 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);
}

View 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,

View 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);

View 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);

View 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))
{

View 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))
{

View File

@ -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. */