[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/raeburn-startup 5c337b4 01/17: Use getc_unlocked.
From: |
Ken Raeburn |
Subject: |
[Emacs-diffs] scratch/raeburn-startup 5c337b4 01/17: Use getc_unlocked. |
Date: |
Thu, 15 Dec 2016 11:33:17 +0000 (UTC) |
branch: scratch/raeburn-startup
commit 5c337b45e2b64a3601437093455c7b0412ed0529
Author: Ken Raeburn <address@hidden>
Commit: Ken Raeburn <address@hidden>
Use getc_unlocked.
* configure.ac: Check for getc_unlocked.
* src/charset.c (read_hex, load_charset_map_from_file): Use
getc_unlocked instead of getc.
(getc_unlocked) [!HAVE_GETC_UNLOCKED]: Fall back to getc.
* src/lread.c (readbyte_from_file, Fget_file_char, read1,
getc_unlocked): Likewise.
---
configure.ac | 2 +-
src/charset.c | 14 +++++++++-----
src/lread.c | 12 ++++++++----
3 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/configure.ac b/configure.ac
index 2d116de..425e338 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4158,7 +4158,7 @@ AC_CHECK_HEADERS(valgrind/valgrind.h)
AC_CHECK_MEMBERS([struct unipair.unicode], [], [], [[#include <linux/kd.h>]])
-AC_CHECK_FUNCS_ONCE([sbrk tzset])
+AC_CHECK_FUNCS_ONCE([getc_unlocked sbrk tzset])
ok_so_far=yes
AC_CHECK_FUNC(socket, , ok_so_far=no)
diff --git a/src/charset.c b/src/charset.c
index ff937bc..e6226ce 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -198,6 +198,10 @@ static struct
#define GET_TEMP_CHARSET_WORK_DECODER(CODE) \
(temp_charset_work->table.decoder[(CODE)])
+
+#ifndef HAVE_GETC_UNLOCKED
+#define getc_unlocked getc
+#endif
/* Set to 1 to warn that a charset map is loaded and thus a buffer
@@ -416,15 +420,15 @@ read_hex (FILE *fp, bool *eof, bool *overflow)
int c;
unsigned n;
- while ((c = getc (fp)) != EOF)
+ while ((c = getc_unlocked (fp)) != EOF)
{
if (c == '#')
{
- while ((c = getc (fp)) != EOF && c != '\n');
+ while ((c = getc_unlocked (fp)) != EOF && c != '\n');
}
else if (c == '0')
{
- if ((c = getc (fp)) == EOF || c == 'x')
+ if ((c = getc_unlocked (fp)) == EOF || c == 'x')
break;
}
}
@@ -434,7 +438,7 @@ read_hex (FILE *fp, bool *eof, bool *overflow)
return 0;
}
n = 0;
- while (c_isxdigit (c = getc (fp)))
+ while (c_isxdigit (c = getc_unlocked (fp)))
{
if (INT_LEFT_SHIFT_OVERFLOW (n, 4))
*overflow = 1;
@@ -508,7 +512,7 @@ load_charset_map_from_file (struct charset *charset,
Lisp_Object mapfile,
from = read_hex (fp, &eof, &overflow);
if (eof)
break;
- if (getc (fp) == '-')
+ if (getc_unlocked (fp) == '-')
to = read_hex (fp, &eof, &overflow);
else
to = from;
diff --git a/src/lread.c b/src/lread.c
index eab9b8b..ada5cbf 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -72,6 +72,10 @@ along with GNU Emacs. If not, see
<http://www.gnu.org/licenses/>. */
#define file_tell ftell
#endif
+#ifndef HAVE_GETC_UNLOCKED
+#define getc_unlocked getc
+#endif
+
/* The association list of objects read with the #n=object form.
Each member of the list has the form (n . object), and is used to
look up the object for the corresponding #n# construct.
@@ -445,7 +449,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)
@@ -454,7 +458,7 @@ readbyte_from_file (int c, Lisp_Object readcharfun)
QUIT;
block_input ();
clearerr (instream);
- c = getc (instream);
+ c = getc_unlocked (instream);
}
unblock_input ();
@@ -759,7 +763,7 @@ DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0,
0, 0,
{
register Lisp_Object val;
block_input ();
- XSETINT (val, getc (instream));
+ XSETINT (val, getc_unlocked (instream));
unblock_input ();
return val;
}
@@ -2847,7 +2851,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool
first_in_list)
/* Copy that many characters into saved_doc_string. */
block_input ();
for (i = 0; i < nskip && c >= 0; i++)
- saved_doc_string[i] = c = getc (instream);
+ saved_doc_string[i] = c = getc_unlocked (instream);
unblock_input ();
saved_doc_string_length = i;
- [Emacs-diffs] scratch/raeburn-startup 702bcad 15/17: Don't memset storage we're about to fill anyway., (continued)
- [Emacs-diffs] scratch/raeburn-startup 702bcad 15/17: Don't memset storage we're about to fill anyway., Ken Raeburn, 2016/12/15
- [Emacs-diffs] scratch/raeburn-startup c95f727 16/17: Dump defvars for special variables only., Ken Raeburn, 2016/12/15
- [Emacs-diffs] scratch/raeburn-startup 8e7ec27 07/17: Use a hash table for seen_list, similar to read_objects_map., Ken Raeburn, 2016/12/15
- [Emacs-diffs] scratch/raeburn-startup dcc4b55 04/17: Replace read_objects assoc list with two hash tables., Ken Raeburn, 2016/12/15
- [Emacs-diffs] scratch/raeburn-startup 8f37b82 08/17: Stefan's patch to write out and load "dumped.elc"; Oct 31 version., Ken Raeburn, 2016/12/15
- [Emacs-diffs] scratch/raeburn-startup 872c9f6 05/17: Don't generate excessive hash tables during reads., Ken Raeburn, 2016/12/15
- [Emacs-diffs] scratch/raeburn-startup 44f3368 11/17: Force purification off when using dumped.elc., Ken Raeburn, 2016/12/15
- [Emacs-diffs] scratch/raeburn-startup 2fa607a 10/17: Increase the obarray size., Ken Raeburn, 2016/12/15
- [Emacs-diffs] scratch/raeburn-startup 6120138 12/17: Don't get into an error loop if dumped.elc isn't found., Ken Raeburn, 2016/12/15
- [Emacs-diffs] scratch/raeburn-startup 913592c 14/17: Optimize reading of ASCII symbols from a .elc file., Ken Raeburn, 2016/12/15
- [Emacs-diffs] scratch/raeburn-startup 5c337b4 01/17: Use getc_unlocked.,
Ken Raeburn <=
- [Emacs-diffs] scratch/raeburn-startup 6a7d996 17/17: Don't dump a copy of the obarray., Ken Raeburn, 2016/12/15
- [Emacs-diffs] scratch/raeburn-startup 4c8f07e 09/17: Increase gc-cons-threshold., Ken Raeburn, 2016/12/15