mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-05-20 06:56:05 +02:00
31869: reduce WINCH-twaddling in shingetline()
This commit is contained in:
parent
610f376f4d
commit
21bbd96d0d
|
@ -1,3 +1,7 @@
|
|||
2013-10-21 Barton E. Schaefer <schaefer@zsh.org>
|
||||
|
||||
* 31869: Src/input.c: reduce WINCH-twaddling in shingetline()
|
||||
|
||||
2013-10-19 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* 31851: Src/exec.c: execstring() should display string to
|
||||
|
|
|
@ -142,14 +142,14 @@ shingetline(void)
|
|||
char *p;
|
||||
|
||||
p = buf;
|
||||
winch_unblock();
|
||||
for (;;) {
|
||||
winch_unblock();
|
||||
do {
|
||||
errno = 0;
|
||||
c = fgetc(bshin);
|
||||
} while (c < 0 && errno == EINTR);
|
||||
winch_block();
|
||||
if (c < 0 || c == '\n') {
|
||||
winch_block();
|
||||
if (c == '\n')
|
||||
*p++ = '\n';
|
||||
if (p > buf) {
|
||||
|
@ -165,11 +165,13 @@ shingetline(void)
|
|||
} else
|
||||
*p++ = c;
|
||||
if (p >= buf + BUFSIZ - 1) {
|
||||
winch_block();
|
||||
line = zrealloc(line, ll + (p - buf) + 1);
|
||||
memcpy(line + ll, buf, p - buf);
|
||||
ll += p - buf;
|
||||
line[ll] = '\0';
|
||||
p = buf;
|
||||
winch_unblock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue