summary refs log tree commit diff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2013-10-21 08:36:52 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2013-10-21 08:36:52 -0700
commit21bbd96d0dc9ff7ebd677ff8de550823a8a81f6a (patch)
tree93b33d166c252f9dee4dcd26a0d50f1beafe00f6
parent610f376f4d3c119c27076afca0edcf99ef53b428 (diff)
downloadzsh-21bbd96d0dc9ff7ebd677ff8de550823a8a81f6a.tar.gz
zsh-21bbd96d0dc9ff7ebd677ff8de550823a8a81f6a.tar.xz
zsh-21bbd96d0dc9ff7ebd677ff8de550823a8a81f6a.zip
31869: reduce WINCH-twaddling in shingetline()
-rw-r--r--ChangeLog4
-rw-r--r--Src/input.c6
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 3064963d5..c577068a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/Src/input.c b/Src/input.c
index 9bd9663bf..4ac7e6ec8 100644
--- a/Src/input.c
+++ b/Src/input.c
@@ -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();
 	}
     }
 }