From feda07c641b865c8913e3fc34f28ad88f2d6da7e Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Tue, 25 Nov 2014 22:14:50 +0100 Subject: 33770: avoid calling identical FIONREAD ioctl twice in succession --- ChangeLog | 3 +++ Src/Zle/zle_main.c | 14 +++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0a021339d..08f53b631 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2014-11-25 Oliver Kiddle + * 33770: Src/Zle/zle_main.c: avoid calling identical FIONREAD + ioctl twice in succession + * users/19365 (credit Death Jester and Jan Larres): Completion/Base/Completer/_external_pwds; completer for current directory of other shell processes diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index d157e36c2..a38f55bfe 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -238,9 +238,9 @@ zsetterm(void) * we can't set up the terminal for zle *at all* until * we are sure there is no more typeahead to come. So * if there is typeahead, we set the flag delayzsetterm. - * Then getbyte() performs another FIONREAD call; if that is - * 0, we have finally used up all the typeahead, and it is - * safe to alter the terminal, which we do at that point. + * Then getbyte() calls here to performs another FIONREAD call; + * if that is 0, we have finally used up all the typeahead, and + * it is safe to alter the terminal, which we do at that point. */ delayzsetterm = 1; return; @@ -884,12 +884,8 @@ getbyte(long do_keytmout, int *timeout) ret = STOUC(kungetbuf[--kungetct]); else { #ifdef FIONREAD - if (delayzsetterm) { - int val; - ioctl(SHTTY, FIONREAD, (char *)&val); - if (!val) - zsetterm(); - } + if (delayzsetterm) + zsetterm(); #endif for (;;) { int q = queue_signal_level(); -- cgit 1.4.1