From ada7878ba0d097b798277aaa095e9d935a64fa99 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 18 Mar 2004 11:28:51 +0000 Subject: Based on a patch from Alexandre Oliva, remove all reference to 'bzero' (which is not a SuSv3 symbol). Rather than using __bzero internally per Alexandre's original patch, use memset instead. --- libc/inet/rpc/bindresvport.c | 2 +- libc/inet/rpc/clnt_generic.c | 4 ++-- libc/inet/rpc/pmap_rmt.c | 2 +- libc/inet/rpc/svc_simple.c | 2 +- libc/inet/rpc/svc_tcp.c | 2 +- libc/inet/rpc/svc_udp.c | 4 ++-- libc/inet/rpc/xdr_array.c | 2 +- libc/inet/rpc/xdr_reference.c | 2 +- libc/string/wstring.c | 3 ++- libc/sysdeps/linux/common/poll.c | 24 ++++++++++++------------ libutil/logout.c | 4 ++-- 11 files changed, 26 insertions(+), 25 deletions(-) diff --git a/libc/inet/rpc/bindresvport.c b/libc/inet/rpc/bindresvport.c index 579f17be7..1234f0682 100644 --- a/libc/inet/rpc/bindresvport.c +++ b/libc/inet/rpc/bindresvport.c @@ -58,7 +58,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/libc/inet/rpc/clnt_generic.c b/libc/inet/rpc/clnt_generic.c index 79df33113..349c0f62d 100644 --- a/libc/inet/rpc/clnt_generic.c +++ b/libc/inet/rpc/clnt_generic.c @@ -63,7 +63,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; @@ -110,7 +110,7 @@ clnt_create (const char *hostname, u_long prog, u_long vers, } sin.sin_family = h->h_addrtype; sin.sin_port = 0; - bzero (sin.sin_zero, sizeof (sin.sin_zero)); + memset (sin.sin_zero, 0, sizeof (sin.sin_zero)); memcpy ((char *) &sin.sin_addr, h->h_addr, h->h_length); #warning getprotobyname is not reentrant... Add getprotobyname_r diff --git a/libc/inet/rpc/pmap_rmt.c b/libc/inet/rpc/pmap_rmt.c index 6b135ede0..0bb9dd884 100644 --- a/libc/inet/rpc/pmap_rmt.c +++ b/libc/inet/rpc/pmap_rmt.c @@ -279,7 +279,7 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult) fd.fd = sock; fd.events = POLLIN; nets = getbroadcastnets (addrs, sock, inbuf); - 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/libc/inet/rpc/svc_simple.c b/libc/inet/rpc/svc_simple.c index 81dead7a1..afc01bafa 100644 --- a/libc/inet/rpc/svc_simple.c +++ b/libc/inet/rpc/svc_simple.c @@ -161,7 +161,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/libc/inet/rpc/svc_tcp.c b/libc/inet/rpc/svc_tcp.c index cd4bb657d..e7ec083c8 100644 --- a/libc/inet/rpc/svc_tcp.c +++ b/libc/inet/rpc/svc_tcp.c @@ -161,7 +161,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/libc/inet/rpc/svc_udp.c b/libc/inet/rpc/svc_udp.c index 49a6b93ce..5e5dee9a3 100644 --- a/libc/inet/rpc/svc_udp.c +++ b/libc/inet/rpc/svc_udp.c @@ -134,7 +134,7 @@ svcudp_bufcreate (sock, sendsz, recvsz) } madesock = TRUE; } - bzero ((char *) &addr, sizeof (addr)); + memset ((char *) &addr, 0, sizeof (addr)); addr.sin_family = AF_INET; if (bindresvport (sock, &addr)) { @@ -406,7 +406,7 @@ svcudp_destroy (xprt) (type *) mem_alloc((unsigned) (sizeof(type) * (size))) #define BZERO(addr, type, size) \ - bzero((char *) addr, sizeof(type) * (int) (size)) + memset((char *) addr, 0, sizeof(type) * (int) (size)) /* * An entry in the cache diff --git a/libc/inet/rpc/xdr_array.c b/libc/inet/rpc/xdr_array.c index e1cfaa6a0..450f5b2ea 100644 --- a/libc/inet/rpc/xdr_array.c +++ b/libc/inet/rpc/xdr_array.c @@ -117,7 +117,7 @@ xdr_array (xdrs, addrp, sizep, maxsize, elsize, elproc) (void) fputs (_("xdr_array: out of memory\n"), stderr); return FALSE; } - bzero (target, nodesize); + memset (target, 0, nodesize); break; case XDR_FREE: diff --git a/libc/inet/rpc/xdr_reference.c b/libc/inet/rpc/xdr_reference.c index 383d8860a..1569e51b7 100644 --- a/libc/inet/rpc/xdr_reference.c +++ b/libc/inet/rpc/xdr_reference.c @@ -95,7 +95,7 @@ xdr_reference (xdrs, pp, size, proc) (void) fputs (_("xdr_reference: out of memory\n"), stderr); return FALSE; } - bzero (loc, (int) size); + memset (loc, 0, (int) size); break; default: break; diff --git a/libc/string/wstring.c b/libc/string/wstring.c index efe41c37a..f41281357 100644 --- a/libc/string/wstring.c +++ b/libc/string/wstring.c @@ -1734,7 +1734,8 @@ Wchar *Wstpncpy(register Wchar * __restrict s1, /**********************************************************************/ #ifdef L_bzero -void bzero(void *s, size_t n) +weak_alias(__bzero,bzero); +void __bzero(void *s, size_t n) { register unsigned char *p = s; #ifdef __BCC__ diff --git a/libc/sysdeps/linux/common/poll.c b/libc/sysdeps/linux/common/poll.c index 3c26a4933..06c857c43 100644 --- a/libc/sysdeps/linux/common/poll.c +++ b/libc/sysdeps/linux/common/poll.c @@ -62,9 +62,9 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout) /* We can't call FD_ZERO, since FD_ZERO only works with sets of exactly __FD_SETSIZE size. */ - bzero (rset, bytes); - bzero (wset, bytes); - bzero (xset, bytes); + memset (rset, 0, bytes); + memset (wset, 0, bytes); + memset (xset, 0, bytes); for (f = fds; f < &fds[nfds]; ++f) { @@ -86,9 +86,9 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout) nwset = alloca (nbytes); nxset = alloca (nbytes); - bzero ((char *) nrset + bytes, nbytes - bytes); - bzero ((char *) nwset + bytes, nbytes - bytes); - bzero ((char *) nxset + bytes, nbytes - bytes); + memset ((char *) nrset + bytes, 0, nbytes - bytes); + memset ((char *) nwset + bytes, 0, nbytes - bytes); + memset ((char *) nxset + bytes, 0, nbytes - bytes); rset = memcpy (nrset, rset, bytes); wset = memcpy (nwset, wset, bytes); @@ -126,9 +126,9 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout) struct timeval sngl_tv; /* Clear the original set. */ - bzero (rset, bytes); - bzero (wset, bytes); - bzero (xset, bytes); + memset (rset, 0, bytes); + memset (wset, 0, bytes); + memset (xset, 0, bytes); /* This means we don't wait for input. */ sngl_tv.tv_sec = 0; @@ -145,9 +145,9 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout) { int n; - bzero (sngl_rset, bytes); - bzero (sngl_wset, bytes); - bzero (sngl_xset, bytes); + memset (sngl_rset, 0, bytes); + memset (sngl_wset, 0, bytes); + memset (sngl_xset, 0, bytes); if (f->events & POLLIN) FD_SET (f->fd, sngl_rset); diff --git a/libutil/logout.c b/libutil/logout.c index 082579b8f..cf964e4dd 100644 --- a/libutil/logout.c +++ b/libutil/logout.c @@ -45,9 +45,9 @@ logout (const char *line) if( (ut = getutline(&tmp)) ) { /* Clear information about who & from where. */ - bzero (ut->ut_name, sizeof ut->ut_name); + memset (ut->ut_name, 0, sizeof ut->ut_name); #if _HAVE_UT_HOST - 0 - bzero (ut->ut_host, sizeof ut->ut_host); + memset (ut->ut_host, 0, sizeof ut->ut_host); #endif #if _HAVE_UT_TV - 0 gettimeofday (&ut->ut_tv, NULL); -- cgit v1.2.3