Skip to content

Instantly share code, notes, and snippets.

@bsuh
Created September 11, 2015 20:54
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bsuh/e7cba8a61f482b8d8687 to your computer and use it in GitHub Desktop.
Save bsuh/e7cba8a61f482b8d8687 to your computer and use it in GitHub Desktop.
Faster reading of bytes from files in Emacs
diff --git a/src/lread.c b/src/lread.c
index e1a4b33..4f17e39 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -467,7 +467,7 @@ readbyte_from_file (int c, Lisp_Object readcharfun)
}
block_input ();
- c = getc (instream);
+ c = getc_unlocked (instream);
/* Interrupted reads have been observed while reading over the network. */
while (c == EOF && ferror (instream) && errno == EINTR)
@@ -476,7 +476,7 @@ readbyte_from_file (int c, Lisp_Object readcharfun)
QUIT;
block_input ();
clearerr (instream);
- c = getc (instream);
+ c = getc_unlocked (instream);
}
unblock_input ();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment