[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/raeburn-startup d939820 1/2: Fix unbalanced input
From: |
Ken Raeburn |
Subject: |
[Emacs-diffs] scratch/raeburn-startup d939820 1/2: Fix unbalanced input blocking in file-reading specialization. |
Date: |
Thu, 12 Jan 2017 06:40:08 +0000 (UTC) |
branch: scratch/raeburn-startup
commit d9398209eee4fdd65e1a3107f2c832a32f52a222
Author: Ken Raeburn <address@hidden>
Commit: Ken Raeburn <address@hidden>
Fix unbalanced input blocking in file-reading specialization.
* src/lread.c (read1): In the branch specialized for reading from a
file, when looping reading additional bytes for a multibyte character,
unblock input once before the loop and block it again once after.
---
src/lread.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/lread.c b/src/lread.c
index e9abe77..6e7e263 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3418,19 +3418,23 @@ read1 (Lisp_Object readcharfun, int *pch, bool
first_in_list)
i = 0;
buf[i++] = c;
len = BYTES_BY_CHAR_HEAD (c);
- while (i < len)
+ if (i < len)
{
unblock_input ();
- c = readbyte_from_file (-1, readcharfun);
- if (c < 0 || ! TRAILING_CODE_P (c))
+ while (i < len)
{
- while (--i > 1)
- readbyte_from_file (buf[i], readcharfun);
- c = BYTE8_TO_CHAR (buf[0]);
- block_input ();
- goto have_char_from_file;
+ c = readbyte_from_file (-1, readcharfun);
+ if (c < 0 || ! TRAILING_CODE_P (c))
+ {
+ while (--i > 1)
+ readbyte_from_file (buf[i], readcharfun);
+ c = BYTE8_TO_CHAR (buf[0]);
+ block_input ();
+ goto have_char_from_file;
+ }
+ buf[i++] = c;
}
- buf[i++] = c;
+ block_input ();
}
c = STRING_CHAR (buf);
/* fall through */