(bzero, bcopy): Obsolete BSDisms; remove. Remove some calls without

effect.  Replace calls by struct assignment where possible.  Replace
clear buffer, copy string to buffer by strncpy().  Use assignment to
clear when that's clearer.  Replace overlapping copy through bounce
buffer by memmove().  Replace rest by standard memset() and memcpy().
Also use sizeof() instead of literal array sizes for robustness, and
instead of symbolic array sizes for clarity.
This commit is contained in:
Markus Armbruster 2004-01-08 17:54:28 +00:00
parent 2910da23ea
commit 4ae9c417b3
79 changed files with 172 additions and 256 deletions

View file

@ -37,22 +37,6 @@
#include "gen.h"
#include "optlist.h"
#ifdef hpux
#include <memory.h>
void
bzero(s_char *ptr, int len)
{
memset(ptr, 0, len);
}
void
bcopy(s_char *src, s_char *dst, int len)
{
memcpy(dst, src, len);
}
#endif
/*
* space-fill a map or radar scan;
* null terminate

View file

@ -212,7 +212,7 @@ ioqtobuf(struct ioqueue *ioq, s_char *buf, int cc)
if (nbytes > 0) {
if (nleft < nbytes)
nbytes = nleft;
bcopy(io->data + io->offset, offset, nbytes);
memcpy(offset, io->data + io->offset, nbytes);
offset += nbytes;
nleft -= nbytes;
}
@ -312,7 +312,7 @@ appendcc(struct ioqueue *ioq, s_char *buf, int cc)
if (avail > 0) {
/* append to existing buffer */
len = cc > avail ? avail : cc;
bcopy(buf, io->data + io->nbytes, len);
memcpy(io->data + io->nbytes, buf, len);
io->nbytes += len;
ioq->cc += len;
if (avail < cc)
@ -321,7 +321,7 @@ appendcc(struct ioqueue *ioq, s_char *buf, int cc)
/* create a new buffer, minimum bufsize bytes */
len = cc > ioq->bufsize ? cc : ioq->bufsize;
ptr = malloc(len);
bcopy(buf, ptr, cc);
memcpy(ptr, buf, cc);
io = (struct io *)malloc(sizeof(struct io));
io->nbytes = cc;
io->size = len;
@ -414,7 +414,7 @@ ioq_makebuf(struct ioqueue *ioq, char *pBuf, int nBufLen)
if (nbytes > nleft)
break;
bcopy(io->data + io->offset, offset, nbytes);
memcpy(offset, io->data + io->offset, nbytes);
offset += nbytes;
nleft -= nbytes;
ncopied += nbytes;