mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-01 19:41:00 +02:00
31869: reduce WINCH-twaddling in shingetline()
This commit is contained in:
parent
610f376f4d
commit
21bbd96d0d
2 changed files with 8 additions and 2 deletions
|
@ -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>
|
2013-10-19 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||||
|
|
||||||
* 31851: Src/exec.c: execstring() should display string to
|
* 31851: Src/exec.c: execstring() should display string to
|
||||||
|
|
|
@ -142,14 +142,14 @@ shingetline(void)
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
p = buf;
|
p = buf;
|
||||||
|
winch_unblock();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
winch_unblock();
|
|
||||||
do {
|
do {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
c = fgetc(bshin);
|
c = fgetc(bshin);
|
||||||
} while (c < 0 && errno == EINTR);
|
} while (c < 0 && errno == EINTR);
|
||||||
winch_block();
|
|
||||||
if (c < 0 || c == '\n') {
|
if (c < 0 || c == '\n') {
|
||||||
|
winch_block();
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
*p++ = '\n';
|
*p++ = '\n';
|
||||||
if (p > buf) {
|
if (p > buf) {
|
||||||
|
@ -165,11 +165,13 @@ shingetline(void)
|
||||||
} else
|
} else
|
||||||
*p++ = c;
|
*p++ = c;
|
||||||
if (p >= buf + BUFSIZ - 1) {
|
if (p >= buf + BUFSIZ - 1) {
|
||||||
|
winch_block();
|
||||||
line = zrealloc(line, ll + (p - buf) + 1);
|
line = zrealloc(line, ll + (p - buf) + 1);
|
||||||
memcpy(line + ll, buf, p - buf);
|
memcpy(line + ll, buf, p - buf);
|
||||||
ll += p - buf;
|
ll += p - buf;
|
||||||
line[ll] = '\0';
|
line[ll] = '\0';
|
||||||
p = buf;
|
p = buf;
|
||||||
|
winch_unblock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue