summaryrefslogtreecommitdiff
path: root/src/lread.c
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2007-03-20 08:50:31 +0000
committerYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2007-03-20 08:50:31 +0000
commit66cd0949c99ad185fc1ecf4c0e206a695bd19020 (patch)
treec0fcaaaab1c846ed37e06004ae075e32fa4f9d56 /src/lread.c
parent34f5c10fbce94075bfbbfa904c9cc1d595893ad8 (diff)
downloademacs-66cd0949c99ad185fc1ecf4c0e206a695bd19020.tar.gz
emacs-66cd0949c99ad185fc1ecf4c0e206a695bd19020.tar.bz2
emacs-66cd0949c99ad185fc1ecf4c0e206a695bd19020.zip
Include blockinput.h.
(readchar, Fget_file_char): Add BLOCK_INPUT around getc. (unreadchar): Add BLOCK_INPUT around ungetc. (load_unwind): Add BLOCK_INPUT around fclose.
Diffstat (limited to 'src/lread.c')
-rw-r--r--src/lread.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/lread.c b/src/lread.c
index 8fc1335698f..30aab7cce32 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -36,6 +36,7 @@ Boston, MA 02110-1301, USA. */
#include "keyboard.h"
#include "termhooks.h"
#include "coding.h"
+#include "blockinput.h"
#ifdef lint
#include <sys/inode.h>
@@ -324,14 +325,18 @@ readchar (readcharfun)
if (EQ (readcharfun, Qget_file_char))
{
+ BLOCK_INPUT;
c = getc (instream);
+ UNBLOCK_INPUT;
#ifdef EINTR
/* Interrupted reads have been observed while reading over the network */
while (c == EOF && ferror (instream) && errno == EINTR)
{
QUIT;
clearerr (instream);
+ BLOCK_INPUT;
c = getc (instream);
+ UNBLOCK_INPUT;
}
#endif
return c;
@@ -414,7 +419,11 @@ unreadchar (readcharfun, c)
else if (EQ (readcharfun, Qlambda))
read_bytecode_char (1);
else if (EQ (readcharfun, Qget_file_char))
- ungetc (c, instream);
+ {
+ BLOCK_INPUT;
+ ungetc (c, instream);
+ UNBLOCK_INPUT;
+ }
else
call1 (readcharfun, make_number (c));
}
@@ -625,7 +634,9 @@ DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0,
()
{
register Lisp_Object val;
+ BLOCK_INPUT;
XSETINT (val, getc (instream));
+ UNBLOCK_INPUT;
return val;
}
@@ -1044,7 +1055,11 @@ load_unwind (arg) /* used as unwind-protect function in load */
{
FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer;
if (stream != NULL)
- fclose (stream);
+ {
+ BLOCK_INPUT;
+ fclose (stream);
+ UNBLOCK_INPUT;
+ }
if (--load_in_progress < 0) load_in_progress = 0;
return Qnil;
}