Explain what max is and handle i reaching it again.
This commit is contained in:
parent
e2d874fb89
commit
0057d0442d
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: job.c,v 1.179 2015/04/16 11:39:23 joerg Exp $ */
|
||||
/* $NetBSD: job.c,v 1.180 2015/04/16 13:31:03 joerg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -70,14 +70,14 @@
|
|||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: job.c,v 1.179 2015/04/16 11:39:23 joerg Exp $";
|
||||
static char rcsid[] = "$NetBSD: job.c,v 1.180 2015/04/16 13:31:03 joerg Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: job.c,v 1.179 2015/04/16 11:39:23 joerg Exp $");
|
||||
__RCSID("$NetBSD: job.c,v 1.180 2015/04/16 13:31:03 joerg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
|
@ -1878,10 +1878,18 @@ end_loop:
|
|||
(void)fflush(stdout);
|
||||
}
|
||||
}
|
||||
assert(i < max);
|
||||
/* shift the remaining characters down */
|
||||
(void)memmove(job->outBuf, &job->outBuf[i + 1], max - (i + 1));
|
||||
job->curPos = max - (i + 1);
|
||||
/*
|
||||
* max is the last offset still in the buffer. Move any remaining
|
||||
* characters to the start of the buffer and update the end marker
|
||||
* curPos.
|
||||
*/
|
||||
if (i < max) {
|
||||
(void)memmove(job->outBuf, &job->outBuf[i + 1], max - (i + 1));
|
||||
job->curPos = max - (i + 1);
|
||||
} else {
|
||||
assert(i == max);
|
||||
job->curPos = 0;
|
||||
}
|
||||
}
|
||||
if (finish) {
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue