diff options
author | Constantine A. Murenin <cnst@cvs.openbsd.org> | 2007-10-06 19:34:33 +0000 |
---|---|---|
committer | Constantine A. Murenin <cnst@cvs.openbsd.org> | 2007-10-06 19:34:33 +0000 |
commit | 4cb55e22905289871f280eee7c8c3de0ef0e269a (patch) | |
tree | ed72694fb822413f38af5234073f2095c3a5575f /usr.bin/make | |
parent | af76b7cc5c523c7fe7cd9dfcd2f302b9d4f07e14 (diff) |
replace realloc/memset/pointer-arithmetic with recalloc; ok millert@ ray@ espie@
Diffstat (limited to 'usr.bin/make')
-rw-r--r-- | usr.bin/make/job.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index 9464b7f49ce..647ae6a7aa9 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: job.c,v 1.91 2007/09/29 09:59:04 espie Exp $ */ +/* $OpenBSD: job.c,v 1.92 2007/10/06 19:34:32 cnst Exp $ */ /* $NetBSD: job.c,v 1.16 1996/11/06 17:59:08 christos Exp $ */ /* @@ -1001,21 +1001,17 @@ JobExec(Job *job, char **argv) job->curPos = 0; if (outputsp == NULL || job->inPipe > outputsn) { - int bytes, obytes; - char *tmp; + int fdn, ofdn; + fd_set *tmp; - bytes = howmany(job->inPipe+1, NFDBITS) * - sizeof(fd_mask); - obytes = outputsn ? - howmany(outputsn+1, NFDBITS) * - sizeof(fd_mask) : 0; + fdn = howmany(job->inPipe+1, NFDBITS); + ofdn = outputsn ? howmany(outputsn+1, NFDBITS) : 0; - if (bytes != obytes) { - tmp = realloc(outputsp, bytes); + if (fdn != ofdn) { + tmp = recalloc(outputsp, fdn, sizeof(fd_mask)); if (tmp == NULL) return; - memset(tmp + obytes, 0, bytes - obytes); - outputsp = (fd_set *)tmp; + outputsp = tmp; } outputsn = job->inPipe; } |