diff options
| -rwxr-xr-x | admin/merge-gnulib | 2 | ||||
| -rw-r--r-- | admin/unidata/unidata-gen.el | 94 | ||||
| -rw-r--r-- | configure.ac | 2 | ||||
| -rw-r--r-- | lib-src/ebrowse.c | 8 | ||||
| -rw-r--r-- | lib-src/emacsclient.c | 3 | ||||
| -rw-r--r-- | lib-src/etags.c | 1 | ||||
| -rw-r--r-- | lib-src/hexl.c | 2 | ||||
| -rw-r--r-- | lib-src/make-docfile.c | 10 | ||||
| -rw-r--r-- | lib-src/movemail.c | 4 | ||||
| -rw-r--r-- | lib-src/profile.c | 2 | ||||
| -rw-r--r-- | lib-src/update-game-score.c | 3 | ||||
| -rw-r--r-- | lib/gnulib.mk.in | 11 | ||||
| -rw-r--r-- | lib/unlocked-io.h | 136 | ||||
| -rw-r--r-- | lisp/descr-text.el | 14 | ||||
| -rw-r--r-- | lisp/net/shr.el | 1 | ||||
| -rw-r--r-- | m4/gnulib-comp.m4 | 4 | ||||
| -rw-r--r-- | m4/unlocked-io.m4 | 41 | ||||
| -rw-r--r-- | src/charset.c | 6 | ||||
| -rw-r--r-- | src/cm.c | 14 | ||||
| -rw-r--r-- | src/dispnew.c | 22 | ||||
| -rw-r--r-- | src/emacs.c | 8 | ||||
| -rw-r--r-- | src/fileio.c | 16 | ||||
| -rw-r--r-- | src/image.c | 11 | ||||
| -rw-r--r-- | src/keyboard.c | 19 | ||||
| -rw-r--r-- | src/lread.c | 19 | ||||
| -rw-r--r-- | src/minibuf.c | 8 | ||||
| -rw-r--r-- | src/print.c | 10 | ||||
| -rw-r--r-- | src/sysdep.c | 15 | ||||
| -rw-r--r-- | src/sysstdio.h | 41 | ||||
| -rw-r--r-- | src/term.c | 47 | ||||
| -rw-r--r-- | src/xfaces.c | 2 |
31 files changed, 404 insertions, 172 deletions
diff --git a/admin/merge-gnulib b/admin/merge-gnulib index d4bbf17cb3d..85921ba1ba6 100755 --- a/admin/merge-gnulib +++ b/admin/merge-gnulib | |||
| @@ -40,7 +40,7 @@ GNULIB_MODULES=' | |||
| 40 | sig2str socklen stat-time std-gnu11 stdalign stddef stdio | 40 | sig2str socklen stat-time std-gnu11 stdalign stddef stdio |
| 41 | stpcpy strftime strtoimax symlink sys_stat | 41 | stpcpy strftime strtoimax symlink sys_stat |
| 42 | sys_time time time_r time_rz timegm timer-time timespec-add timespec-sub | 42 | sys_time time time_r time_rz timegm timer-time timespec-add timespec-sub |
| 43 | update-copyright utimens | 43 | update-copyright unlocked-io utimens |
| 44 | vla warnings | 44 | vla warnings |
| 45 | ' | 45 | ' |
| 46 | 46 | ||
diff --git a/admin/unidata/unidata-gen.el b/admin/unidata/unidata-gen.el index e1e896ce29c..478099c831a 100644 --- a/admin/unidata/unidata-gen.el +++ b/admin/unidata/unidata-gen.el | |||
| @@ -1346,50 +1346,56 @@ Property value is a symbol `o' (Open), `c' (Close), or `n' (None)." | |||
| 1346 | (generator (unidata-prop-generator proplist)) | 1346 | (generator (unidata-prop-generator proplist)) |
| 1347 | (default-value (unidata-prop-default proplist)) | 1347 | (default-value (unidata-prop-default proplist)) |
| 1348 | (val-list (unidata-prop-val-list proplist)) | 1348 | (val-list (unidata-prop-val-list proplist)) |
| 1349 | (table (progn | 1349 | (check #x400) |
| 1350 | (message "Generating %S table..." prop) | 1350 | table decoder alist) |
| 1351 | (funcall generator prop index default-value val-list))) | 1351 | ;; We compare values in unidata.txt with the ones returned by various |
| 1352 | (decoder (char-table-extra-slot table 1)) | 1352 | ;; generator functions. However, SpecialCasing.txt is read directly by |
| 1353 | (alist (and (functionp index) | 1353 | ;; unidata-gen-table-special-casing--do-load and there is no other file |
| 1354 | (funcall index))) | 1354 | ;; to compare those values with. This is why we’re skipping the check |
| 1355 | (check #x400)) | 1355 | ;; for special casing properties. |
| 1356 | (dolist (e unidata-list) | 1356 | (unless (eq generator 'unidata-gen-table-special-casing) |
| 1357 | (let* ((char (car e)) | 1357 | (setq table (progn |
| 1358 | (val1 | 1358 | (message "Generating %S table..." prop) |
| 1359 | (if alist (nth 1 (assoc char alist)) | 1359 | (funcall generator prop index default-value val-list)) |
| 1360 | (nth index e))) | 1360 | decoder (char-table-extra-slot table 1)) |
| 1361 | val2) | 1361 | (unless (integerp decoder) |
| 1362 | (if (and (stringp val1) (= (length val1) 0)) | 1362 | (setq alist (and (functionp index) (funcall index))) |
| 1363 | (setq val1 nil)) | 1363 | (dolist (e unidata-list) |
| 1364 | (unless (or (consp char) | 1364 | (let ((char (car e)) val1 val2) |
| 1365 | (integerp decoder)) | 1365 | (unless (consp char) |
| 1366 | (setq val2 | 1366 | (setq val1 (if alist |
| 1367 | (cond ((functionp decoder) | 1367 | (nth 1 (assoc char alist)) |
| 1368 | (funcall decoder char (aref table char) table)) | 1368 | (nth index e))) |
| 1369 | (t ; must be nil | 1369 | (and (stringp val1) |
| 1370 | (aref table char)))) | 1370 | (= (length val1) 0) |
| 1371 | (if val1 | 1371 | (setq val1 nil)) |
| 1372 | (cond ((eq generator 'unidata-gen-table-symbol) | 1372 | (if val1 |
| 1373 | (setq val1 (intern val1))) | 1373 | (cond ((eq generator 'unidata-gen-table-symbol) |
| 1374 | ((eq generator 'unidata-gen-table-integer) | 1374 | (setq val1 (intern val1))) |
| 1375 | (setq val1 (string-to-number val1))) | 1375 | ((eq generator 'unidata-gen-table-integer) |
| 1376 | ((eq generator 'unidata-gen-table-character) | 1376 | (setq val1 (string-to-number val1))) |
| 1377 | (setq val1 (string-to-number val1 16))) | 1377 | ((eq generator 'unidata-gen-table-character) |
| 1378 | ((eq generator 'unidata-gen-table-decomposition) | 1378 | (setq val1 (string-to-number val1 16))) |
| 1379 | (setq val1 (unidata-split-decomposition val1)))) | 1379 | ((eq generator 'unidata-gen-table-decomposition) |
| 1380 | (cond ((eq prop 'decomposition) | 1380 | (setq val1 (unidata-split-decomposition val1)))) |
| 1381 | (setq val1 (list char))) | 1381 | (cond ((eq prop 'decomposition) |
| 1382 | ((eq prop 'bracket-type) | 1382 | (setq val1 (list char))) |
| 1383 | (setq val1 'n)))) | 1383 | ((eq prop 'bracket-type) |
| 1384 | (when (>= char check) | 1384 | (setq val1 'n)))) |
| 1385 | (message "%S %04X" prop check) | 1385 | (setq val2 (aref table char)) |
| 1386 | (setq check (+ check #x400))) | 1386 | (when decoder |
| 1387 | (or (equal val1 val2) | 1387 | (setq val2 (funcall decoder char val2 table))) |
| 1388 | ;; <control> characters get a 'name' property of nil | 1388 | (when (>= char check) |
| 1389 | (and (eq prop 'name) (string= val1 "<control>") (null val2)) | 1389 | (message "%S %04X" prop check) |
| 1390 | (insert (format "> %04X %S\n< %04X %S\n" | 1390 | (setq check (+ check #x400))) |
| 1391 | char val1 char val2))) | 1391 | (or (equal val1 val2) |
| 1392 | (sit-for 0)))))))) | 1392 | ;; <control> characters get a 'name' property of nil |
| 1393 | (and (eq prop 'name) | ||
| 1394 | (string= val1 "<control>") | ||
| 1395 | (null val2)) | ||
| 1396 | (insert (format "> %04X %S\n< %04X %S\n" | ||
| 1397 | char val1 char val2))) | ||
| 1398 | (sit-for 0)))))))))) | ||
| 1393 | 1399 | ||
| 1394 | ;; The entry functions. They generate files described in the header | 1400 | ;; The entry functions. They generate files described in the header |
| 1395 | ;; comment of this file. | 1401 | ;; comment of this file. |
diff --git a/configure.ac b/configure.ac index 65c5f9268ad..ef61107b025 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -4240,7 +4240,7 @@ AC_CHECK_HEADERS(valgrind/valgrind.h) | |||
| 4240 | 4240 | ||
| 4241 | AC_CHECK_MEMBERS([struct unipair.unicode], [], [], [[#include <linux/kd.h>]]) | 4241 | AC_CHECK_MEMBERS([struct unipair.unicode], [], [], [[#include <linux/kd.h>]]) |
| 4242 | 4242 | ||
| 4243 | AC_CHECK_FUNCS_ONCE([getc_unlocked sbrk]) | 4243 | AC_CHECK_FUNCS_ONCE([sbrk]) |
| 4244 | 4244 | ||
| 4245 | ok_so_far=yes | 4245 | ok_so_far=yes |
| 4246 | AC_CHECK_FUNC(socket, , ok_so_far=no) | 4246 | AC_CHECK_FUNC(socket, , ok_so_far=no) |
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index 51d181997b1..e77b7c94cca 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c | |||
| @@ -20,21 +20,21 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 20 | 20 | ||
| 21 | #include <config.h> | 21 | #include <config.h> |
| 22 | #include <stddef.h> | 22 | #include <stddef.h> |
| 23 | #include <stdio.h> | ||
| 24 | #include <stdlib.h> | 23 | #include <stdlib.h> |
| 25 | #include <string.h> | 24 | #include <string.h> |
| 26 | #include <ctype.h> | 25 | #include <ctype.h> |
| 27 | #include <assert.h> | 26 | #include <assert.h> |
| 28 | #include <getopt.h> | 27 | #include <getopt.h> |
| 29 | 28 | ||
| 29 | #include <flexmember.h> | ||
| 30 | #include <min-max.h> | ||
| 31 | #include <unlocked-io.h> | ||
| 32 | |||
| 30 | /* The SunOS compiler doesn't have SEEK_END. */ | 33 | /* The SunOS compiler doesn't have SEEK_END. */ |
| 31 | #ifndef SEEK_END | 34 | #ifndef SEEK_END |
| 32 | #define SEEK_END 2 | 35 | #define SEEK_END 2 |
| 33 | #endif | 36 | #endif |
| 34 | 37 | ||
| 35 | #include <flexmember.h> | ||
| 36 | #include <min-max.h> | ||
| 37 | |||
| 38 | /* Files are read in chunks of this number of bytes. */ | 38 | /* Files are read in chunks of this number of bytes. */ |
| 39 | 39 | ||
| 40 | enum { READ_CHUNK_SIZE = 100 * 1024 }; | 40 | enum { READ_CHUNK_SIZE = 100 * 1024 }; |
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 8828b7652de..f1d4e8976da 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c | |||
| @@ -73,7 +73,6 @@ char *w32_getenv (const char *); | |||
| 73 | 73 | ||
| 74 | #include <stdarg.h> | 74 | #include <stdarg.h> |
| 75 | #include <ctype.h> | 75 | #include <ctype.h> |
| 76 | #include <stdio.h> | ||
| 77 | #include <stdlib.h> | 76 | #include <stdlib.h> |
| 78 | #include <string.h> | 77 | #include <string.h> |
| 79 | #include <getopt.h> | 78 | #include <getopt.h> |
| @@ -84,6 +83,8 @@ char *w32_getenv (const char *); | |||
| 84 | #include <signal.h> | 83 | #include <signal.h> |
| 85 | #include <errno.h> | 84 | #include <errno.h> |
| 86 | 85 | ||
| 86 | #include <unlocked-io.h> | ||
| 87 | |||
| 87 | #ifndef VERSION | 88 | #ifndef VERSION |
| 88 | #define VERSION "unspecified" | 89 | #define VERSION "unspecified" |
| 89 | #endif | 90 | #endif |
diff --git a/lib-src/etags.c b/lib-src/etags.c index 6f280d8ab40..e5ff7bd10fc 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -123,6 +123,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; | |||
| 123 | #include <errno.h> | 123 | #include <errno.h> |
| 124 | #include <fcntl.h> | 124 | #include <fcntl.h> |
| 125 | #include <binary-io.h> | 125 | #include <binary-io.h> |
| 126 | #include <unlocked-io.h> | ||
| 126 | #include <c-ctype.h> | 127 | #include <c-ctype.h> |
| 127 | #include <c-strcase.h> | 128 | #include <c-strcase.h> |
| 128 | 129 | ||
diff --git a/lib-src/hexl.c b/lib-src/hexl.c index 319ce8bc890..d949af08902 100644 --- a/lib-src/hexl.c +++ b/lib-src/hexl.c | |||
| @@ -22,11 +22,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 22 | #include <config.h> | 22 | #include <config.h> |
| 23 | 23 | ||
| 24 | #include <inttypes.h> | 24 | #include <inttypes.h> |
| 25 | #include <stdio.h> | ||
| 26 | #include <stdlib.h> | 25 | #include <stdlib.h> |
| 27 | #include <string.h> | 26 | #include <string.h> |
| 28 | 27 | ||
| 29 | #include <binary-io.h> | 28 | #include <binary-io.h> |
| 29 | #include <unlocked-io.h> | ||
| 30 | 30 | ||
| 31 | static char *progname; | 31 | static char *progname; |
| 32 | 32 | ||
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index 9470bd635f5..6b2cc110403 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c | |||
| @@ -39,10 +39,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 39 | #include <stdarg.h> | 39 | #include <stdarg.h> |
| 40 | #include <stddef.h> | 40 | #include <stddef.h> |
| 41 | #include <stdint.h> | 41 | #include <stdint.h> |
| 42 | #include <stdio.h> | ||
| 43 | #include <stdlib.h> | 42 | #include <stdlib.h> |
| 44 | #include <string.h> | 43 | #include <string.h> |
| 45 | 44 | ||
| 45 | #include <binary-io.h> | ||
| 46 | #include <intprops.h> | ||
| 47 | #include <min-max.h> | ||
| 48 | #include <unlocked-io.h> | ||
| 49 | |||
| 46 | #ifdef WINDOWSNT | 50 | #ifdef WINDOWSNT |
| 47 | /* Defined to be sys_fopen in ms-w32.h, but only #ifdef emacs, so this | 51 | /* Defined to be sys_fopen in ms-w32.h, but only #ifdef emacs, so this |
| 48 | is really just insurance. */ | 52 | is really just insurance. */ |
| @@ -50,10 +54,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 50 | #include <direct.h> | 54 | #include <direct.h> |
| 51 | #endif /* WINDOWSNT */ | 55 | #endif /* WINDOWSNT */ |
| 52 | 56 | ||
| 53 | #include <binary-io.h> | ||
| 54 | #include <intprops.h> | ||
| 55 | #include <min-max.h> | ||
| 56 | |||
| 57 | #ifdef DOS_NT | 57 | #ifdef DOS_NT |
| 58 | /* Defined to be sys_chdir in ms-w32.h, but only #ifdef emacs, so this | 58 | /* Defined to be sys_chdir in ms-w32.h, but only #ifdef emacs, so this |
| 59 | is really just insurance. | 59 | is really just insurance. |
diff --git a/lib-src/movemail.c b/lib-src/movemail.c index cd12c48ed36..e5ca0b16611 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c | |||
| @@ -59,7 +59,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 59 | #include <sys/types.h> | 59 | #include <sys/types.h> |
| 60 | #include <sys/stat.h> | 60 | #include <sys/stat.h> |
| 61 | #include <sys/file.h> | 61 | #include <sys/file.h> |
| 62 | #include <stdio.h> | ||
| 63 | #include <stdlib.h> | 62 | #include <stdlib.h> |
| 64 | #include <errno.h> | 63 | #include <errno.h> |
| 65 | #include <time.h> | 64 | #include <time.h> |
| @@ -69,6 +68,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 69 | #include <fcntl.h> | 68 | #include <fcntl.h> |
| 70 | #include <signal.h> | 69 | #include <signal.h> |
| 71 | #include <string.h> | 70 | #include <string.h> |
| 71 | |||
| 72 | #include <unlocked-io.h> | ||
| 73 | |||
| 72 | #include "syswait.h" | 74 | #include "syswait.h" |
| 73 | #ifdef MAIL_USE_POP | 75 | #ifdef MAIL_USE_POP |
| 74 | #include "pop.h" | 76 | #include "pop.h" |
diff --git a/lib-src/profile.c b/lib-src/profile.c index 253f00e2d80..f4ab45c1718 100644 --- a/lib-src/profile.c +++ b/lib-src/profile.c | |||
| @@ -34,11 +34,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 34 | #include <config.h> | 34 | #include <config.h> |
| 35 | 35 | ||
| 36 | #include <inttypes.h> | 36 | #include <inttypes.h> |
| 37 | #include <stdio.h> | ||
| 38 | #include <stdlib.h> | 37 | #include <stdlib.h> |
| 39 | 38 | ||
| 40 | #include <intprops.h> | 39 | #include <intprops.h> |
| 41 | #include <systime.h> | 40 | #include <systime.h> |
| 41 | #include <unlocked-io.h> | ||
| 42 | 42 | ||
| 43 | static struct timespec TV1; | 43 | static struct timespec TV1; |
| 44 | static int watch_not_started = 1; /* flag */ | 44 | static int watch_not_started = 1; /* flag */ |
diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c index 5edc8e79569..942aeeb399d 100644 --- a/lib-src/update-game-score.c +++ b/lib-src/update-game-score.c | |||
| @@ -39,7 +39,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 39 | #include <limits.h> | 39 | #include <limits.h> |
| 40 | #include <string.h> | 40 | #include <string.h> |
| 41 | #include <stdlib.h> | 41 | #include <stdlib.h> |
| 42 | #include <stdio.h> | ||
| 43 | #include <time.h> | 42 | #include <time.h> |
| 44 | #include <pwd.h> | 43 | #include <pwd.h> |
| 45 | #include <ctype.h> | 44 | #include <ctype.h> |
| @@ -47,6 +46,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 47 | #include <sys/stat.h> | 46 | #include <sys/stat.h> |
| 48 | #include <getopt.h> | 47 | #include <getopt.h> |
| 49 | 48 | ||
| 49 | #include <unlocked-io.h> | ||
| 50 | |||
| 50 | #ifdef WINDOWSNT | 51 | #ifdef WINDOWSNT |
| 51 | #include "ntlib.h" | 52 | #include "ntlib.h" |
| 52 | #endif | 53 | #endif |
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 509089e6391..fd0f9e5c780 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | # the same distribution terms as the rest of that program. | 21 | # the same distribution terms as the rest of that program. |
| 22 | # | 22 | # |
| 23 | # Generated by gnulib-tool. | 23 | # Generated by gnulib-tool. |
| 24 | # Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=setenv --avoid=sigprocmask --avoid=stat --avoid=stdarg --avoid=stdbool --avoid=threadlib --avoid=tzset --avoid=unsetenv --avoid=utime --avoid=utime-h --gnu-make --makefile-name=gnulib.mk.in --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-leading-zeros count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 diffseq dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode filevercmp flexmember fstatat fsync getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog ignore-value intprops largefile lstat manywarnings memrchr minmax mkostemp mktime pipe2 pselect pthread_sigmask putenv qcopy-acl readlink readlinkat sig2str socklen stat-time std-gnu11 stdalign stddef stdio stpcpy strftime strtoimax symlink sys_stat sys_time time time_r time_rz timegm timer-time timespec-add timespec-sub update-copyright utimens vla warnings | 24 | # Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=setenv --avoid=sigprocmask --avoid=stat --avoid=stdarg --avoid=stdbool --avoid=threadlib --avoid=tzset --avoid=unsetenv --avoid=utime --avoid=utime-h --gnu-make --makefile-name=gnulib.mk.in --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-leading-zeros count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 diffseq dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode filevercmp flexmember fstatat fsync getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog ignore-value intprops largefile lstat manywarnings memrchr minmax mkostemp mktime pipe2 pselect pthread_sigmask putenv qcopy-acl readlink readlinkat sig2str socklen stat-time std-gnu11 stdalign stddef stdio stpcpy strftime strtoimax symlink sys_stat sys_time time time_r time_rz timegm timer-time timespec-add timespec-sub unlocked-io update-copyright utimens vla warnings |
| 25 | 25 | ||
| 26 | 26 | ||
| 27 | MOSTLYCLEANFILES += core *.stackdump | 27 | MOSTLYCLEANFILES += core *.stackdump |
| @@ -2996,6 +2996,15 @@ EXTRA_DIST += unistd.in.h | |||
| 2996 | endif | 2996 | endif |
| 2997 | ## end gnulib module unistd | 2997 | ## end gnulib module unistd |
| 2998 | 2998 | ||
| 2999 | ## begin gnulib module unlocked-io | ||
| 3000 | ifeq (,$(OMIT_GNULIB_MODULE_unlocked-io)) | ||
| 3001 | |||
| 3002 | |||
| 3003 | EXTRA_DIST += unlocked-io.h | ||
| 3004 | |||
| 3005 | endif | ||
| 3006 | ## end gnulib module unlocked-io | ||
| 3007 | |||
| 2999 | ## begin gnulib module update-copyright | 3008 | ## begin gnulib module update-copyright |
| 3000 | ifeq (,$(OMIT_GNULIB_MODULE_update-copyright)) | 3009 | ifeq (,$(OMIT_GNULIB_MODULE_update-copyright)) |
| 3001 | 3010 | ||
diff --git a/lib/unlocked-io.h b/lib/unlocked-io.h new file mode 100644 index 00000000000..aaf60a0fb4e --- /dev/null +++ b/lib/unlocked-io.h | |||
| @@ -0,0 +1,136 @@ | |||
| 1 | /* Prefer faster, non-thread-safe stdio functions if available. | ||
| 2 | |||
| 3 | Copyright (C) 2001-2004, 2009-2017 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | This program is free software: you can redistribute it and/or modify | ||
| 6 | it under the terms of the GNU General Public License as published by | ||
| 7 | the Free Software Foundation; either version 3 of the License, or | ||
| 8 | (at your option) any later version. | ||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, | ||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | GNU General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License | ||
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 17 | |||
| 18 | /* Written by Jim Meyering. */ | ||
| 19 | |||
| 20 | #ifndef UNLOCKED_IO_H | ||
| 21 | # define UNLOCKED_IO_H 1 | ||
| 22 | |||
| 23 | /* These are wrappers for functions/macros from the GNU C library, and | ||
| 24 | from other C libraries supporting POSIX's optional thread-safe functions. | ||
| 25 | |||
| 26 | The standard I/O functions are thread-safe. These *_unlocked ones are | ||
| 27 | more efficient but not thread-safe. That they're not thread-safe is | ||
| 28 | fine since all of the applications in this package are single threaded. | ||
| 29 | |||
| 30 | Also, some code that is shared with the GNU C library may invoke | ||
| 31 | the *_unlocked functions directly. On hosts that lack those | ||
| 32 | functions, invoke the non-thread-safe versions instead. */ | ||
| 33 | |||
| 34 | # include <stdio.h> | ||
| 35 | |||
| 36 | # if HAVE_DECL_CLEARERR_UNLOCKED | ||
| 37 | # undef clearerr | ||
| 38 | # define clearerr(x) clearerr_unlocked (x) | ||
| 39 | # else | ||
| 40 | # define clearerr_unlocked(x) clearerr (x) | ||
| 41 | # endif | ||
| 42 | |||
| 43 | # if HAVE_DECL_FEOF_UNLOCKED | ||
| 44 | # undef feof | ||
| 45 | # define feof(x) feof_unlocked (x) | ||
| 46 | # else | ||
| 47 | # define feof_unlocked(x) feof (x) | ||
| 48 | # endif | ||
| 49 | |||
| 50 | # if HAVE_DECL_FERROR_UNLOCKED | ||
| 51 | # undef ferror | ||
| 52 | # define ferror(x) ferror_unlocked (x) | ||
| 53 | # else | ||
| 54 | # define ferror_unlocked(x) ferror (x) | ||
| 55 | # endif | ||
| 56 | |||
| 57 | # if HAVE_DECL_FFLUSH_UNLOCKED | ||
| 58 | # undef fflush | ||
| 59 | # define fflush(x) fflush_unlocked (x) | ||
| 60 | # else | ||
| 61 | # define fflush_unlocked(x) fflush (x) | ||
| 62 | # endif | ||
| 63 | |||
| 64 | # if HAVE_DECL_FGETS_UNLOCKED | ||
| 65 | # undef fgets | ||
| 66 | # define fgets(x,y,z) fgets_unlocked (x,y,z) | ||
| 67 | # else | ||
| 68 | # define fgets_unlocked(x,y,z) fgets (x,y,z) | ||
| 69 | # endif | ||
| 70 | |||
| 71 | # if HAVE_DECL_FPUTC_UNLOCKED | ||
| 72 | # undef fputc | ||
| 73 | # define fputc(x,y) fputc_unlocked (x,y) | ||
| 74 | # else | ||
| 75 | # define fputc_unlocked(x,y) fputc (x,y) | ||
| 76 | # endif | ||
| 77 | |||
| 78 | # if HAVE_DECL_FPUTS_UNLOCKED | ||
| 79 | # undef fputs | ||
| 80 | # define fputs(x,y) fputs_unlocked (x,y) | ||
| 81 | # else | ||
| 82 | # define fputs_unlocked(x,y) fputs (x,y) | ||
| 83 | # endif | ||
| 84 | |||
| 85 | # if HAVE_DECL_FREAD_UNLOCKED | ||
| 86 | # undef fread | ||
| 87 | # define fread(w,x,y,z) fread_unlocked (w,x,y,z) | ||
| 88 | # else | ||
| 89 | # define fread_unlocked(w,x,y,z) fread (w,x,y,z) | ||
| 90 | # endif | ||
| 91 | |||
| 92 | # if HAVE_DECL_FWRITE_UNLOCKED | ||
| 93 | # undef fwrite | ||
| 94 | # define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z) | ||
| 95 | # else | ||
| 96 | # define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z) | ||
| 97 | # endif | ||
| 98 | |||
| 99 | # if HAVE_DECL_GETC_UNLOCKED | ||
| 100 | # undef getc | ||
| 101 | # define getc(x) getc_unlocked (x) | ||
| 102 | # else | ||
| 103 | # define getc_unlocked(x) getc (x) | ||
| 104 | # endif | ||
| 105 | |||
| 106 | # if HAVE_DECL_GETCHAR_UNLOCKED | ||
| 107 | # undef getchar | ||
| 108 | # define getchar() getchar_unlocked () | ||
| 109 | # else | ||
| 110 | # define getchar_unlocked() getchar () | ||
| 111 | # endif | ||
| 112 | |||
| 113 | # if HAVE_DECL_PUTC_UNLOCKED | ||
| 114 | # undef putc | ||
| 115 | # define putc(x,y) putc_unlocked (x,y) | ||
| 116 | # else | ||
| 117 | # define putc_unlocked(x,y) putc (x,y) | ||
| 118 | # endif | ||
| 119 | |||
| 120 | # if HAVE_DECL_PUTCHAR_UNLOCKED | ||
| 121 | # undef putchar | ||
| 122 | # define putchar(x) putchar_unlocked (x) | ||
| 123 | # else | ||
| 124 | # define putchar_unlocked(x) putchar (x) | ||
| 125 | # endif | ||
| 126 | |||
| 127 | # undef flockfile | ||
| 128 | # define flockfile(x) ((void) 0) | ||
| 129 | |||
| 130 | # undef ftrylockfile | ||
| 131 | # define ftrylockfile(x) 0 | ||
| 132 | |||
| 133 | # undef funlockfile | ||
| 134 | # define funlockfile(x) ((void) 0) | ||
| 135 | |||
| 136 | #endif /* UNLOCKED_IO_H */ | ||
diff --git a/lisp/descr-text.el b/lisp/descr-text.el index 6a6a8ea4479..6f36bbed680 100644 --- a/lisp/descr-text.el +++ b/lisp/descr-text.el | |||
| @@ -413,12 +413,11 @@ relevant to POS." | |||
| 413 | (multibyte-p enable-multibyte-characters) | 413 | (multibyte-p enable-multibyte-characters) |
| 414 | (overlays (mapcar (lambda (o) (overlay-properties o)) | 414 | (overlays (mapcar (lambda (o) (overlay-properties o)) |
| 415 | (overlays-at pos))) | 415 | (overlays-at pos))) |
| 416 | (char-description (if (not multibyte-p) | 416 | (char-description (if (< char 128) |
| 417 | (single-key-description char) | 417 | (single-key-description char) |
| 418 | (if (< char 128) | 418 | (string (if (not multibyte-p) |
| 419 | (single-key-description char) | 419 | (decode-char 'eight-bit char) |
| 420 | (string-to-multibyte | 420 | char)))) |
| 421 | (char-to-string char))))) | ||
| 422 | (text-props-desc | 421 | (text-props-desc |
| 423 | (let ((tmp-buf (generate-new-buffer " *text-props*"))) | 422 | (let ((tmp-buf (generate-new-buffer " *text-props*"))) |
| 424 | (unwind-protect | 423 | (unwind-protect |
| @@ -635,7 +634,9 @@ relevant to POS." | |||
| 635 | ("buffer code" | 634 | ("buffer code" |
| 636 | ,(if multibyte-p | 635 | ,(if multibyte-p |
| 637 | (encoded-string-description | 636 | (encoded-string-description |
| 638 | (string-as-unibyte (char-to-string char)) nil) | 637 | (encode-coding-string (char-to-string char) |
| 638 | 'emacs-internal) | ||
| 639 | nil) | ||
| 639 | (format "#x%02X" char))) | 640 | (format "#x%02X" char))) |
| 640 | ("file code" | 641 | ("file code" |
| 641 | ,@(if multibyte-p | 642 | ,@(if multibyte-p |
| @@ -704,7 +705,6 @@ relevant to POS." | |||
| 704 | (called-interactively-p 'interactive)) | 705 | (called-interactively-p 'interactive)) |
| 705 | (with-help-window (help-buffer) | 706 | (with-help-window (help-buffer) |
| 706 | (with-current-buffer standard-output | 707 | (with-current-buffer standard-output |
| 707 | (set-buffer-multibyte multibyte-p) | ||
| 708 | (let ((formatter (format "%%%ds:" max-width))) | 708 | (let ((formatter (format "%%%ds:" max-width))) |
| 709 | (dolist (elt item-list) | 709 | (dolist (elt item-list) |
| 710 | (when (cadr elt) | 710 | (when (cadr elt) |
diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 2a6b3960c46..45ef379af54 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el | |||
| @@ -512,6 +512,7 @@ size, and full-buffer size." | |||
| 512 | (* (frame-char-width) 2) | 512 | (* (frame-char-width) 2) |
| 513 | 0)))) | 513 | 0)))) |
| 514 | (shr-insert text) | 514 | (shr-insert text) |
| 515 | (shr-fill-lines (point-min) (point-max)) | ||
| 515 | (buffer-string))))) | 516 | (buffer-string))))) |
| 516 | 517 | ||
| 517 | (define-inline shr-char-breakable-p (char) | 518 | (define-inline shr-char-breakable-p (char) |
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 1ac58e871cc..107645df4fd 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 | |||
| @@ -158,6 +158,7 @@ AC_DEFUN([gl_EARLY], | |||
| 158 | # Code from module timespec-sub: | 158 | # Code from module timespec-sub: |
| 159 | # Code from module u64: | 159 | # Code from module u64: |
| 160 | # Code from module unistd: | 160 | # Code from module unistd: |
| 161 | # Code from module unlocked-io: | ||
| 161 | # Code from module update-copyright: | 162 | # Code from module update-copyright: |
| 162 | # Code from module utimens: | 163 | # Code from module utimens: |
| 163 | # Code from module vararrays: | 164 | # Code from module vararrays: |
| @@ -399,6 +400,7 @@ AC_DEFUN([gl_INIT], | |||
| 399 | gl_TIMER_TIME | 400 | gl_TIMER_TIME |
| 400 | gl_TIMESPEC | 401 | gl_TIMESPEC |
| 401 | gl_UNISTD_H | 402 | gl_UNISTD_H |
| 403 | gl_FUNC_GLIBC_UNLOCKED_IO | ||
| 402 | gl_UTIMENS | 404 | gl_UTIMENS |
| 403 | AC_C_VARARRAYS | 405 | AC_C_VARARRAYS |
| 404 | gl_gnulib_enabled_260941c0e5dc67ec9e87d1fb321c300b=false | 406 | gl_gnulib_enabled_260941c0e5dc67ec9e87d1fb321c300b=false |
| @@ -940,6 +942,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 940 | lib/u64.h | 942 | lib/u64.h |
| 941 | lib/unistd.c | 943 | lib/unistd.c |
| 942 | lib/unistd.in.h | 944 | lib/unistd.in.h |
| 945 | lib/unlocked-io.h | ||
| 943 | lib/utimens.c | 946 | lib/utimens.c |
| 944 | lib/utimens.h | 947 | lib/utimens.h |
| 945 | lib/verify.h | 948 | lib/verify.h |
| @@ -1044,6 +1047,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 1044 | m4/timespec.m4 | 1047 | m4/timespec.m4 |
| 1045 | m4/tm_gmtoff.m4 | 1048 | m4/tm_gmtoff.m4 |
| 1046 | m4/unistd_h.m4 | 1049 | m4/unistd_h.m4 |
| 1050 | m4/unlocked-io.m4 | ||
| 1047 | m4/utimens.m4 | 1051 | m4/utimens.m4 |
| 1048 | m4/utimes.m4 | 1052 | m4/utimes.m4 |
| 1049 | m4/vararrays.m4 | 1053 | m4/vararrays.m4 |
diff --git a/m4/unlocked-io.m4 b/m4/unlocked-io.m4 new file mode 100644 index 00000000000..448ccac2f0e --- /dev/null +++ b/m4/unlocked-io.m4 | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | # unlocked-io.m4 serial 15 | ||
| 2 | |||
| 3 | # Copyright (C) 1998-2006, 2009-2017 Free Software Foundation, Inc. | ||
| 4 | # | ||
| 5 | # This file is free software; the Free Software Foundation | ||
| 6 | # gives unlimited permission to copy and/or distribute it, | ||
| 7 | # with or without modifications, as long as this notice is preserved. | ||
| 8 | |||
| 9 | dnl From Jim Meyering. | ||
| 10 | dnl | ||
| 11 | dnl See if the glibc *_unlocked I/O macros or functions are available. | ||
| 12 | dnl Use only those *_unlocked macros or functions that are declared | ||
| 13 | dnl (because some of them were declared in Solaris 2.5.1 but were removed | ||
| 14 | dnl in Solaris 2.6, whereas we want binaries built on Solaris 2.5.1 to run | ||
| 15 | dnl on Solaris 2.6). | ||
| 16 | |||
| 17 | AC_DEFUN([gl_FUNC_GLIBC_UNLOCKED_IO], | ||
| 18 | [ | ||
| 19 | AC_DEFINE([USE_UNLOCKED_IO], [1], | ||
| 20 | [Define to 1 if you want getc etc. to use unlocked I/O if available. | ||
| 21 | Unlocked I/O can improve performance in unithreaded apps, | ||
| 22 | but it is not safe for multithreaded apps.]) | ||
| 23 | |||
| 24 | dnl Persuade glibc and Solaris <stdio.h> to declare | ||
| 25 | dnl fgets_unlocked(), fputs_unlocked() etc. | ||
| 26 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
| 27 | |||
| 28 | AC_CHECK_DECLS_ONCE([clearerr_unlocked]) | ||
| 29 | AC_CHECK_DECLS_ONCE([feof_unlocked]) | ||
| 30 | AC_CHECK_DECLS_ONCE([ferror_unlocked]) | ||
| 31 | AC_CHECK_DECLS_ONCE([fflush_unlocked]) | ||
| 32 | AC_CHECK_DECLS_ONCE([fgets_unlocked]) | ||
| 33 | AC_CHECK_DECLS_ONCE([fputc_unlocked]) | ||
| 34 | AC_CHECK_DECLS_ONCE([fputs_unlocked]) | ||
| 35 | AC_CHECK_DECLS_ONCE([fread_unlocked]) | ||
| 36 | AC_CHECK_DECLS_ONCE([fwrite_unlocked]) | ||
| 37 | AC_CHECK_DECLS_ONCE([getc_unlocked]) | ||
| 38 | AC_CHECK_DECLS_ONCE([getchar_unlocked]) | ||
| 39 | AC_CHECK_DECLS_ONCE([putc_unlocked]) | ||
| 40 | AC_CHECK_DECLS_ONCE([putchar_unlocked]) | ||
| 41 | ]) | ||
diff --git a/src/charset.c b/src/charset.c index 9d15375dd79..d0840f7d2a9 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -29,7 +29,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 29 | #include <config.h> | 29 | #include <config.h> |
| 30 | 30 | ||
| 31 | #include <errno.h> | 31 | #include <errno.h> |
| 32 | #include <stdio.h> | ||
| 33 | #include <stdlib.h> | 32 | #include <stdlib.h> |
| 34 | #include <unistd.h> | 33 | #include <unistd.h> |
| 35 | #include <limits.h> | 34 | #include <limits.h> |
| @@ -40,6 +39,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 40 | #include "charset.h" | 39 | #include "charset.h" |
| 41 | #include "coding.h" | 40 | #include "coding.h" |
| 42 | #include "buffer.h" | 41 | #include "buffer.h" |
| 42 | #include "sysstdio.h" | ||
| 43 | 43 | ||
| 44 | /*** GENERAL NOTES on CODED CHARACTER SETS (CHARSETS) *** | 44 | /*** GENERAL NOTES on CODED CHARACTER SETS (CHARSETS) *** |
| 45 | 45 | ||
| @@ -198,10 +198,6 @@ static struct | |||
| 198 | 198 | ||
| 199 | #define GET_TEMP_CHARSET_WORK_DECODER(CODE) \ | 199 | #define GET_TEMP_CHARSET_WORK_DECODER(CODE) \ |
| 200 | (temp_charset_work->table.decoder[(CODE)]) | 200 | (temp_charset_work->table.decoder[(CODE)]) |
| 201 | |||
| 202 | #ifndef HAVE_GETC_UNLOCKED | ||
| 203 | #define getc_unlocked getc | ||
| 204 | #endif | ||
| 205 | 201 | ||
| 206 | 202 | ||
| 207 | /* Set to 1 to warn that a charset map is loaded and thus a buffer | 203 | /* Set to 1 to warn that a charset map is loaded and thus a buffer |
| @@ -19,10 +19,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | #include <config.h> | 21 | #include <config.h> |
| 22 | #include <stdio.h> | ||
| 23 | 22 | ||
| 24 | #include "lisp.h" | 23 | #include "lisp.h" |
| 25 | #include "cm.h" | 24 | #include "cm.h" |
| 25 | #include "sysstdio.h" | ||
| 26 | #include "termchar.h" | 26 | #include "termchar.h" |
| 27 | #include "tparam.h" | 27 | #include "tparam.h" |
| 28 | 28 | ||
| @@ -45,8 +45,8 @@ int | |||
| 45 | cmputc (int c) | 45 | cmputc (int c) |
| 46 | { | 46 | { |
| 47 | if (current_tty->termscript) | 47 | if (current_tty->termscript) |
| 48 | putc (c & 0177, current_tty->termscript); | 48 | putc_unlocked (c & 0177, current_tty->termscript); |
| 49 | putc (c & 0177, current_tty->output); | 49 | putc_unlocked (c & 0177, current_tty->output); |
| 50 | return c; | 50 | return c; |
| 51 | } | 51 | } |
| 52 | 52 | ||
| @@ -117,11 +117,11 @@ cmcheckmagic (struct tty_display_info *tty) | |||
| 117 | if (!MagicWrap (tty) || curY (tty) >= FrameRows (tty) - 1) | 117 | if (!MagicWrap (tty) || curY (tty) >= FrameRows (tty) - 1) |
| 118 | emacs_abort (); | 118 | emacs_abort (); |
| 119 | if (tty->termscript) | 119 | if (tty->termscript) |
| 120 | putc ('\r', tty->termscript); | 120 | putc_unlocked ('\r', tty->termscript); |
| 121 | putc ('\r', tty->output); | 121 | putc_unlocked ('\r', tty->output); |
| 122 | if (tty->termscript) | 122 | if (tty->termscript) |
| 123 | putc ('\n', tty->termscript); | 123 | putc_unlocked ('\n', tty->termscript); |
| 124 | putc ('\n', tty->output); | 124 | putc_unlocked ('\n', tty->output); |
| 125 | curX (tty) = 0; | 125 | curX (tty) = 0; |
| 126 | curY (tty)++; | 126 | curY (tty)++; |
| 127 | } | 127 | } |
diff --git a/src/dispnew.c b/src/dispnew.c index 27c69bde831..925e44d9804 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -3126,9 +3126,9 @@ update_frame (struct frame *f, bool force_p, bool inhibit_hairy_id_p) | |||
| 3126 | if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) | 3126 | if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) |
| 3127 | { | 3127 | { |
| 3128 | if (FRAME_TTY (f)->termscript) | 3128 | if (FRAME_TTY (f)->termscript) |
| 3129 | fflush (FRAME_TTY (f)->termscript); | 3129 | fflush_unlocked (FRAME_TTY (f)->termscript); |
| 3130 | if (FRAME_TERMCAP_P (f)) | 3130 | if (FRAME_TERMCAP_P (f)) |
| 3131 | fflush (FRAME_TTY (f)->output); | 3131 | fflush_unlocked (FRAME_TTY (f)->output); |
| 3132 | } | 3132 | } |
| 3133 | 3133 | ||
| 3134 | /* Check window matrices for lost pointers. */ | 3134 | /* Check window matrices for lost pointers. */ |
| @@ -3181,8 +3181,8 @@ update_frame_with_menu (struct frame *f, int row, int col) | |||
| 3181 | update_end (f); | 3181 | update_end (f); |
| 3182 | 3182 | ||
| 3183 | if (FRAME_TTY (f)->termscript) | 3183 | if (FRAME_TTY (f)->termscript) |
| 3184 | fflush (FRAME_TTY (f)->termscript); | 3184 | fflush_unlocked (FRAME_TTY (f)->termscript); |
| 3185 | fflush (FRAME_TTY (f)->output); | 3185 | fflush_unlocked (FRAME_TTY (f)->output); |
| 3186 | /* Check window matrices for lost pointers. */ | 3186 | /* Check window matrices for lost pointers. */ |
| 3187 | #if GLYPH_DEBUG | 3187 | #if GLYPH_DEBUG |
| 3188 | #if 0 | 3188 | #if 0 |
| @@ -4531,7 +4531,7 @@ update_frame_1 (struct frame *f, bool force_p, bool inhibit_id_p, | |||
| 4531 | ptrdiff_t outq = __fpending (display_output); | 4531 | ptrdiff_t outq = __fpending (display_output); |
| 4532 | if (outq > 900 | 4532 | if (outq > 900 |
| 4533 | || (outq > 20 && ((i - 1) % preempt_count == 0))) | 4533 | || (outq > 20 && ((i - 1) % preempt_count == 0))) |
| 4534 | fflush (display_output); | 4534 | fflush_unlocked (display_output); |
| 4535 | } | 4535 | } |
| 4536 | } | 4536 | } |
| 4537 | 4537 | ||
| @@ -5615,13 +5615,13 @@ when TERMINAL is nil. */) | |||
| 5615 | 5615 | ||
| 5616 | if (tty->termscript) | 5616 | if (tty->termscript) |
| 5617 | { | 5617 | { |
| 5618 | fwrite (SDATA (string), 1, SBYTES (string), tty->termscript); | 5618 | fwrite_unlocked (SDATA (string), 1, SBYTES (string), tty->termscript); |
| 5619 | fflush (tty->termscript); | 5619 | fflush_unlocked (tty->termscript); |
| 5620 | } | 5620 | } |
| 5621 | out = tty->output; | 5621 | out = tty->output; |
| 5622 | } | 5622 | } |
| 5623 | fwrite (SDATA (string), 1, SBYTES (string), out); | 5623 | fwrite_unlocked (SDATA (string), 1, SBYTES (string), out); |
| 5624 | fflush (out); | 5624 | fflush_unlocked (out); |
| 5625 | unblock_input (); | 5625 | unblock_input (); |
| 5626 | return Qnil; | 5626 | return Qnil; |
| 5627 | } | 5627 | } |
| @@ -5636,7 +5636,7 @@ terminate any keyboard macro currently executing. */) | |||
| 5636 | if (!NILP (arg)) | 5636 | if (!NILP (arg)) |
| 5637 | { | 5637 | { |
| 5638 | if (noninteractive) | 5638 | if (noninteractive) |
| 5639 | putchar (07); | 5639 | putchar_unlocked (07); |
| 5640 | else | 5640 | else |
| 5641 | ring_bell (XFRAME (selected_frame)); | 5641 | ring_bell (XFRAME (selected_frame)); |
| 5642 | } | 5642 | } |
| @@ -5650,7 +5650,7 @@ void | |||
| 5650 | bitch_at_user (void) | 5650 | bitch_at_user (void) |
| 5651 | { | 5651 | { |
| 5652 | if (noninteractive) | 5652 | if (noninteractive) |
| 5653 | putchar (07); | 5653 | putchar_unlocked (07); |
| 5654 | else if (!INTERACTIVE) /* Stop executing a keyboard macro. */ | 5654 | else if (!INTERACTIVE) /* Stop executing a keyboard macro. */ |
| 5655 | { | 5655 | { |
| 5656 | const char *msg | 5656 | const char *msg |
diff --git a/src/emacs.c b/src/emacs.c index da8df1bf1c7..0fec7167588 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -23,7 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 23 | 23 | ||
| 24 | #include <errno.h> | 24 | #include <errno.h> |
| 25 | #include <fcntl.h> | 25 | #include <fcntl.h> |
| 26 | #include <stdio.h> | ||
| 27 | #include <stdlib.h> | 26 | #include <stdlib.h> |
| 28 | 27 | ||
| 29 | #include <sys/file.h> | 28 | #include <sys/file.h> |
| @@ -33,6 +32,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 33 | 32 | ||
| 34 | #define MAIN_PROGRAM | 33 | #define MAIN_PROGRAM |
| 35 | #include "lisp.h" | 34 | #include "lisp.h" |
| 35 | #include "sysstdio.h" | ||
| 36 | 36 | ||
| 37 | #ifdef WINDOWSNT | 37 | #ifdef WINDOWSNT |
| 38 | #include <fcntl.h> | 38 | #include <fcntl.h> |
| @@ -885,7 +885,7 @@ main (int argc, char **argv) | |||
| 885 | } | 885 | } |
| 886 | #endif /* HAVE_SETRLIMIT and RLIMIT_STACK and not CYGWIN */ | 886 | #endif /* HAVE_SETRLIMIT and RLIMIT_STACK and not CYGWIN */ |
| 887 | 887 | ||
| 888 | clearerr (stdin); | 888 | clearerr_unlocked (stdin); |
| 889 | 889 | ||
| 890 | emacs_backtrace (-1); | 890 | emacs_backtrace (-1); |
| 891 | 891 | ||
| @@ -983,7 +983,7 @@ main (int argc, char **argv) | |||
| 983 | int i; | 983 | int i; |
| 984 | printf ("Usage: %s [OPTION-OR-FILENAME]...\n", argv[0]); | 984 | printf ("Usage: %s [OPTION-OR-FILENAME]...\n", argv[0]); |
| 985 | for (i = 0; i < ARRAYELTS (usage_message); i++) | 985 | for (i = 0; i < ARRAYELTS (usage_message); i++) |
| 986 | fputs (usage_message[i], stdout); | 986 | fputs_unlocked (usage_message[i], stdout); |
| 987 | exit (0); | 987 | exit (0); |
| 988 | } | 988 | } |
| 989 | 989 | ||
| @@ -2197,7 +2197,7 @@ You must run Emacs in batch mode in order to dump it. */) | |||
| 2197 | } | 2197 | } |
| 2198 | #endif | 2198 | #endif |
| 2199 | 2199 | ||
| 2200 | fflush (stdout); | 2200 | fflush_unlocked (stdout); |
| 2201 | /* Tell malloc where start of impure now is. */ | 2201 | /* Tell malloc where start of impure now is. */ |
| 2202 | /* Also arrange for warnings when nearly out of space. */ | 2202 | /* Also arrange for warnings when nearly out of space. */ |
| 2203 | #if !defined SYSTEM_MALLOC && !defined HYBRID_MALLOC | 2203 | #if !defined SYSTEM_MALLOC && !defined HYBRID_MALLOC |
diff --git a/src/fileio.c b/src/fileio.c index cb070029a9b..a57d50b24e0 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -5643,14 +5643,12 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) | |||
| 5643 | { | 5643 | { |
| 5644 | block_input (); | 5644 | block_input (); |
| 5645 | if (!NILP (BVAR (b, filename))) | 5645 | if (!NILP (BVAR (b, filename))) |
| 5646 | { | 5646 | fwrite_unlocked (SDATA (BVAR (b, filename)), 1, |
| 5647 | fwrite (SDATA (BVAR (b, filename)), 1, | 5647 | SBYTES (BVAR (b, filename)), stream); |
| 5648 | SBYTES (BVAR (b, filename)), stream); | 5648 | putc_unlocked ('\n', stream); |
| 5649 | } | 5649 | fwrite_unlocked (SDATA (BVAR (b, auto_save_file_name)), 1, |
| 5650 | putc ('\n', stream); | 5650 | SBYTES (BVAR (b, auto_save_file_name)), stream); |
| 5651 | fwrite (SDATA (BVAR (b, auto_save_file_name)), 1, | 5651 | putc_unlocked ('\n', stream); |
| 5652 | SBYTES (BVAR (b, auto_save_file_name)), stream); | ||
| 5653 | putc ('\n', stream); | ||
| 5654 | unblock_input (); | 5652 | unblock_input (); |
| 5655 | } | 5653 | } |
| 5656 | 5654 | ||
| @@ -5841,7 +5839,7 @@ effect except for flushing STREAM's data. */) | |||
| 5841 | 5839 | ||
| 5842 | binmode = NILP (mode) ? O_TEXT : O_BINARY; | 5840 | binmode = NILP (mode) ? O_TEXT : O_BINARY; |
| 5843 | if (fp != stdin) | 5841 | if (fp != stdin) |
| 5844 | fflush (fp); | 5842 | fflush_unlocked (fp); |
| 5845 | 5843 | ||
| 5846 | return (set_binary_mode (fileno (fp), binmode) == O_BINARY) ? Qt : Qnil; | 5844 | return (set_binary_mode (fileno (fp), binmode) == O_BINARY) ? Qt : Qnil; |
| 5847 | } | 5845 | } |
diff --git a/src/image.c b/src/image.c index aedec7954ee..07c4769e9e3 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -20,7 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 20 | #include <config.h> | 20 | #include <config.h> |
| 21 | 21 | ||
| 22 | #include <fcntl.h> | 22 | #include <fcntl.h> |
| 23 | #include <stdio.h> | ||
| 24 | #include <unistd.h> | 23 | #include <unistd.h> |
| 25 | 24 | ||
| 26 | /* Include this before including <setjmp.h> to work around bugs with | 25 | /* Include this before including <setjmp.h> to work around bugs with |
| @@ -41,6 +40,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 41 | #include "buffer.h" | 40 | #include "buffer.h" |
| 42 | #include "dispextern.h" | 41 | #include "dispextern.h" |
| 43 | #include "blockinput.h" | 42 | #include "blockinput.h" |
| 43 | #include "sysstdio.h" | ||
| 44 | #include "systime.h" | 44 | #include "systime.h" |
| 45 | #include <epaths.h> | 45 | #include <epaths.h> |
| 46 | #include "coding.h" | 46 | #include "coding.h" |
| @@ -2361,7 +2361,7 @@ slurp_file (int fd, ptrdiff_t *size) | |||
| 2361 | This can happen if the file grows as we read it. */ | 2361 | This can happen if the file grows as we read it. */ |
| 2362 | ptrdiff_t buflen = st.st_size; | 2362 | ptrdiff_t buflen = st.st_size; |
| 2363 | buf = xmalloc (buflen + 1); | 2363 | buf = xmalloc (buflen + 1); |
| 2364 | if (fread (buf, 1, buflen + 1, fp) == buflen) | 2364 | if (fread_unlocked (buf, 1, buflen + 1, fp) == buflen) |
| 2365 | *size = buflen; | 2365 | *size = buflen; |
| 2366 | else | 2366 | else |
| 2367 | { | 2367 | { |
| @@ -5890,7 +5890,7 @@ png_read_from_file (png_structp png_ptr, png_bytep data, png_size_t length) | |||
| 5890 | { | 5890 | { |
| 5891 | FILE *fp = png_get_io_ptr (png_ptr); | 5891 | FILE *fp = png_get_io_ptr (png_ptr); |
| 5892 | 5892 | ||
| 5893 | if (fread (data, 1, length, fp) < length) | 5893 | if (fread_unlocked (data, 1, length, fp) < length) |
| 5894 | png_error (png_ptr, "Read error"); | 5894 | png_error (png_ptr, "Read error"); |
| 5895 | } | 5895 | } |
| 5896 | 5896 | ||
| @@ -5959,7 +5959,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c) | |||
| 5959 | } | 5959 | } |
| 5960 | 5960 | ||
| 5961 | /* Check PNG signature. */ | 5961 | /* Check PNG signature. */ |
| 5962 | if (fread (sig, 1, sizeof sig, fp) != sizeof sig | 5962 | if (fread_unlocked (sig, 1, sizeof sig, fp) != sizeof sig |
| 5963 | || png_sig_cmp (sig, 0, sizeof sig)) | 5963 | || png_sig_cmp (sig, 0, sizeof sig)) |
| 5964 | { | 5964 | { |
| 5965 | fclose (fp); | 5965 | fclose (fp); |
| @@ -6598,7 +6598,8 @@ our_stdio_fill_input_buffer (j_decompress_ptr cinfo) | |||
| 6598 | { | 6598 | { |
| 6599 | ptrdiff_t bytes; | 6599 | ptrdiff_t bytes; |
| 6600 | 6600 | ||
| 6601 | bytes = fread (src->buffer, 1, JPEG_STDIO_BUFFER_SIZE, src->file); | 6601 | bytes = fread_unlocked (src->buffer, 1, JPEG_STDIO_BUFFER_SIZE, |
| 6602 | src->file); | ||
| 6602 | if (bytes > 0) | 6603 | if (bytes > 0) |
| 6603 | src->mgr.bytes_in_buffer = bytes; | 6604 | src->mgr.bytes_in_buffer = bytes; |
| 6604 | else | 6605 | else |
diff --git a/src/keyboard.c b/src/keyboard.c index 55486c6d9ab..3442b18409a 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -39,6 +39,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 39 | #include "intervals.h" | 39 | #include "intervals.h" |
| 40 | #include "keymap.h" | 40 | #include "keymap.h" |
| 41 | #include "blockinput.h" | 41 | #include "blockinput.h" |
| 42 | #include "sysstdio.h" | ||
| 42 | #include "systime.h" | 43 | #include "systime.h" |
| 43 | #include "atimer.h" | 44 | #include "atimer.h" |
| 44 | #include "process.h" | 45 | #include "process.h" |
| @@ -3290,7 +3291,7 @@ record_char (Lisp_Object c) | |||
| 3290 | if (INTEGERP (c)) | 3291 | if (INTEGERP (c)) |
| 3291 | { | 3292 | { |
| 3292 | if (XUINT (c) < 0x100) | 3293 | if (XUINT (c) < 0x100) |
| 3293 | putc (XUINT (c), dribble); | 3294 | putc_unlocked (XUINT (c), dribble); |
| 3294 | else | 3295 | else |
| 3295 | fprintf (dribble, " 0x%"pI"x", XUINT (c)); | 3296 | fprintf (dribble, " 0x%"pI"x", XUINT (c)); |
| 3296 | } | 3297 | } |
| @@ -3303,15 +3304,15 @@ record_char (Lisp_Object c) | |||
| 3303 | 3304 | ||
| 3304 | if (SYMBOLP (dribblee)) | 3305 | if (SYMBOLP (dribblee)) |
| 3305 | { | 3306 | { |
| 3306 | putc ('<', dribble); | 3307 | putc_unlocked ('<', dribble); |
| 3307 | fwrite (SDATA (SYMBOL_NAME (dribblee)), sizeof (char), | 3308 | fwrite_unlocked (SDATA (SYMBOL_NAME (dribblee)), sizeof (char), |
| 3308 | SBYTES (SYMBOL_NAME (dribblee)), | 3309 | SBYTES (SYMBOL_NAME (dribblee)), |
| 3309 | dribble); | 3310 | dribble); |
| 3310 | putc ('>', dribble); | 3311 | putc_unlocked ('>', dribble); |
| 3311 | } | 3312 | } |
| 3312 | } | 3313 | } |
| 3313 | 3314 | ||
| 3314 | fflush (dribble); | 3315 | fflush_unlocked (dribble); |
| 3315 | unblock_input (); | 3316 | unblock_input (); |
| 3316 | } | 3317 | } |
| 3317 | } | 3318 | } |
| @@ -3769,7 +3770,7 @@ kbd_buffer_get_event (KBOARD **kbp, | |||
| 3769 | detaching from the terminal. */ | 3770 | detaching from the terminal. */ |
| 3770 | || (IS_DAEMON && DAEMON_RUNNING)) | 3771 | || (IS_DAEMON && DAEMON_RUNNING)) |
| 3771 | { | 3772 | { |
| 3772 | int c = getchar (); | 3773 | int c = getchar_unlocked (); |
| 3773 | XSETINT (obj, c); | 3774 | XSETINT (obj, c); |
| 3774 | *kbp = current_kboard; | 3775 | *kbp = current_kboard; |
| 3775 | return obj; | 3776 | return obj; |
| @@ -10377,7 +10378,7 @@ handle_interrupt (bool in_signal_handler) | |||
| 10377 | sigemptyset (&blocked); | 10378 | sigemptyset (&blocked); |
| 10378 | sigaddset (&blocked, SIGINT); | 10379 | sigaddset (&blocked, SIGINT); |
| 10379 | pthread_sigmask (SIG_BLOCK, &blocked, 0); | 10380 | pthread_sigmask (SIG_BLOCK, &blocked, 0); |
| 10380 | fflush (stdout); | 10381 | fflush_unlocked (stdout); |
| 10381 | } | 10382 | } |
| 10382 | 10383 | ||
| 10383 | reset_all_sys_modes (); | 10384 | reset_all_sys_modes (); |
diff --git a/src/lread.c b/src/lread.c index b01cbd5c072..182f96223a5 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -72,10 +72,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 72 | #define file_tell ftell | 72 | #define file_tell ftell |
| 73 | #endif | 73 | #endif |
| 74 | 74 | ||
| 75 | #ifndef HAVE_GETC_UNLOCKED | ||
| 76 | #define getc_unlocked getc | ||
| 77 | #endif | ||
| 78 | |||
| 79 | /* The objects or placeholders read with the #n=object form. | 75 | /* The objects or placeholders read with the #n=object form. |
| 80 | 76 | ||
| 81 | A hash table maps a number to either a placeholder (while the | 77 | A hash table maps a number to either a placeholder (while the |
| @@ -474,16 +470,15 @@ readbyte_from_file (int c, Lisp_Object readcharfun) | |||
| 474 | } | 470 | } |
| 475 | 471 | ||
| 476 | block_input (); | 472 | block_input (); |
| 477 | c = getc_unlocked (instream); | ||
| 478 | 473 | ||
| 479 | /* Interrupted reads have been observed while reading over the network. */ | 474 | /* Interrupted reads have been observed while reading over the network. */ |
| 480 | while (c == EOF && ferror (instream) && errno == EINTR) | 475 | while ((c = getc_unlocked (instream)) == EOF && errno == EINTR |
| 476 | && ferror_unlocked (instream)) | ||
| 481 | { | 477 | { |
| 482 | unblock_input (); | 478 | unblock_input (); |
| 483 | maybe_quit (); | 479 | maybe_quit (); |
| 484 | block_input (); | 480 | block_input (); |
| 485 | clearerr (instream); | 481 | clearerr_unlocked (instream); |
| 486 | c = getc_unlocked (instream); | ||
| 487 | } | 482 | } |
| 488 | 483 | ||
| 489 | unblock_input (); | 484 | unblock_input (); |
| @@ -1942,13 +1937,13 @@ readevalloop (Lisp_Object readcharfun, | |||
| 1942 | read_objects_map | 1937 | read_objects_map |
| 1943 | = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, | 1938 | = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, |
| 1944 | DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD, | 1939 | DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD, |
| 1945 | Qnil, Qnil); | 1940 | Qnil, false); |
| 1946 | if (! HASH_TABLE_P (read_objects_completed) | 1941 | if (! HASH_TABLE_P (read_objects_completed) |
| 1947 | || XHASH_TABLE (read_objects_completed)->count) | 1942 | || XHASH_TABLE (read_objects_completed)->count) |
| 1948 | read_objects_completed | 1943 | read_objects_completed |
| 1949 | = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, | 1944 | = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, |
| 1950 | DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD, | 1945 | DEFAULT_REHASH_SIZE, DEFAULT_REHASH_THRESHOLD, |
| 1951 | Qnil, Qnil); | 1946 | Qnil, false); |
| 1952 | if (!NILP (Vpurify_flag) && c == '(') | 1947 | if (!NILP (Vpurify_flag) && c == '(') |
| 1953 | { | 1948 | { |
| 1954 | val = read_list (0, readcharfun); | 1949 | val = read_list (0, readcharfun); |
| @@ -2159,12 +2154,12 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end) | |||
| 2159 | || XHASH_TABLE (read_objects_map)->count) | 2154 | || XHASH_TABLE (read_objects_map)->count) |
| 2160 | read_objects_map | 2155 | read_objects_map |
| 2161 | = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, DEFAULT_REHASH_SIZE, | 2156 | = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, DEFAULT_REHASH_SIZE, |
| 2162 | DEFAULT_REHASH_THRESHOLD, Qnil, Qnil); | 2157 | DEFAULT_REHASH_THRESHOLD, Qnil, false); |
| 2163 | if (! HASH_TABLE_P (read_objects_completed) | 2158 | if (! HASH_TABLE_P (read_objects_completed) |
| 2164 | || XHASH_TABLE (read_objects_completed)->count) | 2159 | || XHASH_TABLE (read_objects_completed)->count) |
| 2165 | read_objects_completed | 2160 | read_objects_completed |
| 2166 | = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, DEFAULT_REHASH_SIZE, | 2161 | = make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, DEFAULT_REHASH_SIZE, |
| 2167 | DEFAULT_REHASH_THRESHOLD, Qnil, Qnil); | 2162 | DEFAULT_REHASH_THRESHOLD, Qnil, false); |
| 2168 | if (EQ (Vread_with_symbol_positions, Qt) | 2163 | if (EQ (Vread_with_symbol_positions, Qt) |
| 2169 | || EQ (Vread_with_symbol_positions, stream)) | 2164 | || EQ (Vread_with_symbol_positions, stream)) |
| 2170 | Vread_symbol_positions_list = Qnil; | 2165 | Vread_symbol_positions_list = Qnil; |
diff --git a/src/minibuf.c b/src/minibuf.c index 1bbe276776e..835992fa79d 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -20,7 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 20 | 20 | ||
| 21 | #include <config.h> | 21 | #include <config.h> |
| 22 | #include <errno.h> | 22 | #include <errno.h> |
| 23 | #include <stdio.h> | ||
| 24 | 23 | ||
| 25 | #include <binary-io.h> | 24 | #include <binary-io.h> |
| 26 | 25 | ||
| @@ -31,6 +30,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 31 | #include "frame.h" | 30 | #include "frame.h" |
| 32 | #include "window.h" | 31 | #include "window.h" |
| 33 | #include "keymap.h" | 32 | #include "keymap.h" |
| 33 | #include "sysstdio.h" | ||
| 34 | #include "systty.h" | 34 | #include "systty.h" |
| 35 | 35 | ||
| 36 | /* List of buffers for use as minibuffers. | 36 | /* List of buffers for use as minibuffers. |
| @@ -209,15 +209,15 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial, | |||
| 209 | suppress_echo_on_tty (STDIN_FILENO); | 209 | suppress_echo_on_tty (STDIN_FILENO); |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | fwrite (SDATA (prompt), 1, SBYTES (prompt), stdout); | 212 | fwrite_unlocked (SDATA (prompt), 1, SBYTES (prompt), stdout); |
| 213 | fflush (stdout); | 213 | fflush_unlocked (stdout); |
| 214 | 214 | ||
| 215 | val = Qnil; | 215 | val = Qnil; |
| 216 | size = 100; | 216 | size = 100; |
| 217 | len = 0; | 217 | len = 0; |
| 218 | line = xmalloc (size); | 218 | line = xmalloc (size); |
| 219 | 219 | ||
| 220 | while ((c = getchar ()) != '\n' && c != '\r') | 220 | while ((c = getchar_unlocked ()) != '\n' && c != '\r') |
| 221 | { | 221 | { |
| 222 | if (c == EOF) | 222 | if (c == EOF) |
| 223 | { | 223 | { |
diff --git a/src/print.c b/src/print.c index aaec5b04956..6bf8af9ef93 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -228,7 +228,7 @@ printchar_to_stream (unsigned int ch, FILE *stream) | |||
| 228 | { | 228 | { |
| 229 | if (ASCII_CHAR_P (ch)) | 229 | if (ASCII_CHAR_P (ch)) |
| 230 | { | 230 | { |
| 231 | putc (ch, stream); | 231 | putc_unlocked (ch, stream); |
| 232 | #ifdef WINDOWSNT | 232 | #ifdef WINDOWSNT |
| 233 | /* Send the output to a debugger (nothing happens if there | 233 | /* Send the output to a debugger (nothing happens if there |
| 234 | isn't one). */ | 234 | isn't one). */ |
| @@ -246,7 +246,7 @@ printchar_to_stream (unsigned int ch, FILE *stream) | |||
| 246 | if (encode_p) | 246 | if (encode_p) |
| 247 | encoded_ch = code_convert_string_norecord (encoded_ch, | 247 | encoded_ch = code_convert_string_norecord (encoded_ch, |
| 248 | coding_system, true); | 248 | coding_system, true); |
| 249 | fwrite (SSDATA (encoded_ch), 1, SBYTES (encoded_ch), stream); | 249 | fwrite_unlocked (SSDATA (encoded_ch), 1, SBYTES (encoded_ch), stream); |
| 250 | #ifdef WINDOWSNT | 250 | #ifdef WINDOWSNT |
| 251 | if (print_output_debug_flag && stream == stderr) | 251 | if (print_output_debug_flag && stream == stderr) |
| 252 | OutputDebugString (SSDATA (encoded_ch)); | 252 | OutputDebugString (SSDATA (encoded_ch)); |
| @@ -298,7 +298,7 @@ printchar (unsigned int ch, Lisp_Object fun) | |||
| 298 | if (DISP_TABLE_P (Vstandard_display_table)) | 298 | if (DISP_TABLE_P (Vstandard_display_table)) |
| 299 | printchar_to_stream (ch, stdout); | 299 | printchar_to_stream (ch, stdout); |
| 300 | else | 300 | else |
| 301 | fwrite (str, 1, len, stdout); | 301 | fwrite_unlocked (str, 1, len, stdout); |
| 302 | noninteractive_need_newline = 1; | 302 | noninteractive_need_newline = 1; |
| 303 | } | 303 | } |
| 304 | else | 304 | else |
| @@ -350,7 +350,7 @@ strout (const char *ptr, ptrdiff_t size, ptrdiff_t size_byte, | |||
| 350 | } | 350 | } |
| 351 | } | 351 | } |
| 352 | else | 352 | else |
| 353 | fwrite (ptr, 1, size_byte, stdout); | 353 | fwrite_unlocked (ptr, 1, size_byte, stdout); |
| 354 | 354 | ||
| 355 | noninteractive_need_newline = 1; | 355 | noninteractive_need_newline = 1; |
| 356 | } | 356 | } |
| @@ -801,7 +801,7 @@ append to existing target file. */) | |||
| 801 | report_file_error ("Cannot open debugging output stream", file); | 801 | report_file_error ("Cannot open debugging output stream", file); |
| 802 | } | 802 | } |
| 803 | 803 | ||
| 804 | fflush (stderr); | 804 | fflush_unlocked (stderr); |
| 805 | if (dup2 (fd, STDERR_FILENO) < 0) | 805 | if (dup2 (fd, STDERR_FILENO) < 0) |
| 806 | report_file_error ("dup2", file); | 806 | report_file_error ("dup2", file); |
| 807 | if (fd != stderr_dup) | 807 | if (fd != stderr_dup) |
diff --git a/src/sysdep.c b/src/sysdep.c index 70f4a9dd7ea..b52236769e0 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -1408,7 +1408,7 @@ reset_sys_modes (struct tty_display_info *tty_out) | |||
| 1408 | { | 1408 | { |
| 1409 | if (noninteractive) | 1409 | if (noninteractive) |
| 1410 | { | 1410 | { |
| 1411 | fflush (stdout); | 1411 | fflush_unlocked (stdout); |
| 1412 | return; | 1412 | return; |
| 1413 | } | 1413 | } |
| 1414 | if (!tty_out->term_initted) | 1414 | if (!tty_out->term_initted) |
| @@ -1428,17 +1428,14 @@ reset_sys_modes (struct tty_display_info *tty_out) | |||
| 1428 | } | 1428 | } |
| 1429 | else | 1429 | else |
| 1430 | { /* have to do it the hard way */ | 1430 | { /* have to do it the hard way */ |
| 1431 | int i; | ||
| 1432 | tty_turn_off_insert (tty_out); | 1431 | tty_turn_off_insert (tty_out); |
| 1433 | 1432 | ||
| 1434 | for (i = cursorX (tty_out); i < FrameCols (tty_out) - 1; i++) | 1433 | for (int i = cursorX (tty_out); i < FrameCols (tty_out) - 1; i++) |
| 1435 | { | 1434 | fputc_unlocked (' ', tty_out->output); |
| 1436 | fputc (' ', tty_out->output); | ||
| 1437 | } | ||
| 1438 | } | 1435 | } |
| 1439 | 1436 | ||
| 1440 | cmgoto (tty_out, FrameRows (tty_out) - 1, 0); | 1437 | cmgoto (tty_out, FrameRows (tty_out) - 1, 0); |
| 1441 | fflush (tty_out->output); | 1438 | fflush_unlocked (tty_out->output); |
| 1442 | 1439 | ||
| 1443 | if (tty_out->terminal->reset_terminal_modes_hook) | 1440 | if (tty_out->terminal->reset_terminal_modes_hook) |
| 1444 | tty_out->terminal->reset_terminal_modes_hook (tty_out->terminal); | 1441 | tty_out->terminal->reset_terminal_modes_hook (tty_out->terminal); |
| @@ -3079,7 +3076,7 @@ procfs_ttyname (int rdev) | |||
| 3079 | char minor[25]; /* 2 32-bit numbers + dash */ | 3076 | char minor[25]; /* 2 32-bit numbers + dash */ |
| 3080 | char *endp; | 3077 | char *endp; |
| 3081 | 3078 | ||
| 3082 | for (; !feof (fdev) && !ferror (fdev); name[0] = 0) | 3079 | for (; !feof_unlocked (fdev) && !ferror_unlocked (fdev); name[0] = 0) |
| 3083 | { | 3080 | { |
| 3084 | if (fscanf (fdev, "%*s %s %u %s %*s\n", name, &major, minor) >= 3 | 3081 | if (fscanf (fdev, "%*s %s %u %s %*s\n", name, &major, minor) >= 3 |
| 3085 | && major == MAJOR (rdev)) | 3082 | && major == MAJOR (rdev)) |
| @@ -3129,7 +3126,7 @@ procfs_get_total_memory (void) | |||
| 3129 | break; | 3126 | break; |
| 3130 | 3127 | ||
| 3131 | case 0: | 3128 | case 0: |
| 3132 | while ((c = getc (fmem)) != EOF && c != '\n') | 3129 | while ((c = getc_unlocked (fmem)) != EOF && c != '\n') |
| 3133 | continue; | 3130 | continue; |
| 3134 | done = c == EOF; | 3131 | done = c == EOF; |
| 3135 | break; | 3132 | break; |
diff --git a/src/sysstdio.h b/src/sysstdio.h index 45ee33f5580..7fbcefcdad9 100644 --- a/src/sysstdio.h +++ b/src/sysstdio.h | |||
| @@ -33,4 +33,45 @@ extern FILE *emacs_fopen (char const *, char const *); | |||
| 33 | # define FOPEN_TEXT "" | 33 | # define FOPEN_TEXT "" |
| 34 | #endif | 34 | #endif |
| 35 | 35 | ||
| 36 | /* These are compatible with unlocked-io.h, if both files are included. */ | ||
| 37 | #if !HAVE_DECL_CLEARERR_UNLOCKED | ||
| 38 | # define clearerr_unlocked(x) clearerr (x) | ||
| 39 | #endif | ||
| 40 | #if !HAVE_DECL_FEOF_UNLOCKED | ||
| 41 | # define feof_unlocked(x) feof (x) | ||
| 42 | #endif | ||
| 43 | #if !HAVE_DECL_FERROR_UNLOCKED | ||
| 44 | # define ferror_unlocked(x) ferror (x) | ||
| 45 | #endif | ||
| 46 | #if !HAVE_DECL_FFLUSH_UNLOCKED | ||
| 47 | # define fflush_unlocked(x) fflush (x) | ||
| 48 | #endif | ||
| 49 | #if !HAVE_DECL_FGETS_UNLOCKED | ||
| 50 | # define fgets_unlocked(x,y,z) fgets (x,y,z) | ||
| 51 | #endif | ||
| 52 | #if !HAVE_DECL_FPUTC_UNLOCKED | ||
| 53 | # define fputc_unlocked(x,y) fputc (x,y) | ||
| 54 | #endif | ||
| 55 | #if !HAVE_DECL_FPUTS_UNLOCKED | ||
| 56 | # define fputs_unlocked(x,y) fputs (x,y) | ||
| 57 | #endif | ||
| 58 | #if !HAVE_DECL_FREAD_UNLOCKED | ||
| 59 | # define fread_unlocked(w,x,y,z) fread (w,x,y,z) | ||
| 60 | #endif | ||
| 61 | #if !HAVE_DECL_FWRITE_UNLOCKED | ||
| 62 | # define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z) | ||
| 63 | #endif | ||
| 64 | #if !HAVE_DECL_GETC_UNLOCKED | ||
| 65 | # define getc_unlocked(x) getc (x) | ||
| 66 | #endif | ||
| 67 | #if !HAVE_DECL_GETCHAR_UNLOCKED | ||
| 68 | # define getchar_unlocked() getchar () | ||
| 69 | #endif | ||
| 70 | #if !HAVE_DECL_PUTC_UNLOCKED | ||
| 71 | # define putc_unlocked(x,y) putc (x,y) | ||
| 72 | #endif | ||
| 73 | #if !HAVE_DECL_PUTCHAR_UNLOCKED | ||
| 74 | # define putchar_unlocked(x) putchar (x) | ||
| 75 | #endif | ||
| 76 | |||
| 36 | #endif /* EMACS_SYSSTDIO_H */ | 77 | #endif /* EMACS_SYSSTDIO_H */ |
diff --git a/src/term.c b/src/term.c index 8770aff8a92..3d7f4ada0b9 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -22,7 +22,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 22 | #include <config.h> | 22 | #include <config.h> |
| 23 | #include <errno.h> | 23 | #include <errno.h> |
| 24 | #include <fcntl.h> | 24 | #include <fcntl.h> |
| 25 | #include <stdio.h> | ||
| 26 | #include <stdlib.h> | 25 | #include <stdlib.h> |
| 27 | #include <sys/file.h> | 26 | #include <sys/file.h> |
| 28 | #include <sys/time.h> | 27 | #include <sys/time.h> |
| @@ -45,6 +44,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 45 | #include "keymap.h" | 44 | #include "keymap.h" |
| 46 | #include "blockinput.h" | 45 | #include "blockinput.h" |
| 47 | #include "syssignal.h" | 46 | #include "syssignal.h" |
| 47 | #include "sysstdio.h" | ||
| 48 | #ifdef MSDOS | 48 | #ifdef MSDOS |
| 49 | #include "msdos.h" | 49 | #include "msdos.h" |
| 50 | static int been_here = -1; | 50 | static int been_here = -1; |
| @@ -146,7 +146,7 @@ tty_ring_bell (struct frame *f) | |||
| 146 | OUTPUT (tty, (tty->TS_visible_bell && visible_bell | 146 | OUTPUT (tty, (tty->TS_visible_bell && visible_bell |
| 147 | ? tty->TS_visible_bell | 147 | ? tty->TS_visible_bell |
| 148 | : tty->TS_bell)); | 148 | : tty->TS_bell)); |
| 149 | fflush (tty->output); | 149 | fflush_unlocked (tty->output); |
| 150 | } | 150 | } |
| 151 | } | 151 | } |
| 152 | 152 | ||
| @@ -167,9 +167,10 @@ tty_send_additional_strings (struct terminal *terminal, Lisp_Object sym) | |||
| 167 | Lisp_Object string = XCAR (extra_codes); | 167 | Lisp_Object string = XCAR (extra_codes); |
| 168 | if (STRINGP (string)) | 168 | if (STRINGP (string)) |
| 169 | { | 169 | { |
| 170 | fwrite (SDATA (string), 1, SBYTES (string), tty->output); | 170 | fwrite_unlocked (SDATA (string), 1, SBYTES (string), tty->output); |
| 171 | if (tty->termscript) | 171 | if (tty->termscript) |
| 172 | fwrite (SDATA (string), 1, SBYTES (string), tty->termscript); | 172 | fwrite_unlocked (SDATA (string), 1, SBYTES (string), |
| 173 | tty->termscript); | ||
| 173 | } | 174 | } |
| 174 | } | 175 | } |
| 175 | } | 176 | } |
| @@ -197,7 +198,7 @@ tty_set_terminal_modes (struct terminal *terminal) | |||
| 197 | OUTPUT_IF (tty, tty->TS_keypad_mode); | 198 | OUTPUT_IF (tty, tty->TS_keypad_mode); |
| 198 | losecursor (tty); | 199 | losecursor (tty); |
| 199 | tty_send_additional_strings (terminal, Qtty_mode_set_strings); | 200 | tty_send_additional_strings (terminal, Qtty_mode_set_strings); |
| 200 | fflush (tty->output); | 201 | fflush_unlocked (tty->output); |
| 201 | } | 202 | } |
| 202 | } | 203 | } |
| 203 | 204 | ||
| @@ -220,7 +221,7 @@ tty_reset_terminal_modes (struct terminal *terminal) | |||
| 220 | /* Output raw CR so kernel can track the cursor hpos. */ | 221 | /* Output raw CR so kernel can track the cursor hpos. */ |
| 221 | current_tty = tty; | 222 | current_tty = tty; |
| 222 | cmputc ('\r'); | 223 | cmputc ('\r'); |
| 223 | fflush (tty->output); | 224 | fflush_unlocked (tty->output); |
| 224 | } | 225 | } |
| 225 | } | 226 | } |
| 226 | 227 | ||
| @@ -235,7 +236,7 @@ tty_update_end (struct frame *f) | |||
| 235 | tty_show_cursor (tty); | 236 | tty_show_cursor (tty); |
| 236 | tty_turn_off_insert (tty); | 237 | tty_turn_off_insert (tty); |
| 237 | tty_background_highlight (tty); | 238 | tty_background_highlight (tty); |
| 238 | fflush (tty->output); | 239 | fflush_unlocked (tty->output); |
| 239 | } | 240 | } |
| 240 | 241 | ||
| 241 | /* The implementation of set_terminal_window for termcap frames. */ | 242 | /* The implementation of set_terminal_window for termcap frames. */ |
| @@ -497,8 +498,8 @@ tty_clear_end_of_line (struct frame *f, int first_unused_hpos) | |||
| 497 | for (i = curX (tty); i < first_unused_hpos; i++) | 498 | for (i = curX (tty); i < first_unused_hpos; i++) |
| 498 | { | 499 | { |
| 499 | if (tty->termscript) | 500 | if (tty->termscript) |
| 500 | fputc (' ', tty->termscript); | 501 | fputc_unlocked (' ', tty->termscript); |
| 501 | fputc (' ', tty->output); | 502 | fputc_unlocked (' ', tty->output); |
| 502 | } | 503 | } |
| 503 | cmplus (tty, first_unused_hpos - curX (tty)); | 504 | cmplus (tty, first_unused_hpos - curX (tty)); |
| 504 | } | 505 | } |
| @@ -771,11 +772,11 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len) | |||
| 771 | if (coding->produced > 0) | 772 | if (coding->produced > 0) |
| 772 | { | 773 | { |
| 773 | block_input (); | 774 | block_input (); |
| 774 | fwrite (conversion_buffer, 1, coding->produced, tty->output); | 775 | fwrite_unlocked (conversion_buffer, 1, coding->produced, tty->output); |
| 775 | if (ferror (tty->output)) | 776 | clearerr_unlocked (tty->output); |
| 776 | clearerr (tty->output); | ||
| 777 | if (tty->termscript) | 777 | if (tty->termscript) |
| 778 | fwrite (conversion_buffer, 1, coding->produced, tty->termscript); | 778 | fwrite_unlocked (conversion_buffer, 1, coding->produced, |
| 779 | tty->termscript); | ||
| 779 | unblock_input (); | 780 | unblock_input (); |
| 780 | } | 781 | } |
| 781 | string += n; | 782 | string += n; |
| @@ -832,11 +833,11 @@ tty_write_glyphs_with_face (register struct frame *f, register struct glyph *str | |||
| 832 | if (coding->produced > 0) | 833 | if (coding->produced > 0) |
| 833 | { | 834 | { |
| 834 | block_input (); | 835 | block_input (); |
| 835 | fwrite (conversion_buffer, 1, coding->produced, tty->output); | 836 | fwrite_unlocked (conversion_buffer, 1, coding->produced, tty->output); |
| 836 | if (ferror (tty->output)) | 837 | clearerr_unlocked (tty->output); |
| 837 | clearerr (tty->output); | ||
| 838 | if (tty->termscript) | 838 | if (tty->termscript) |
| 839 | fwrite (conversion_buffer, 1, coding->produced, tty->termscript); | 839 | fwrite_unlocked (conversion_buffer, 1, coding->produced, |
| 840 | tty->termscript); | ||
| 840 | unblock_input (); | 841 | unblock_input (); |
| 841 | } | 842 | } |
| 842 | 843 | ||
| @@ -918,11 +919,11 @@ tty_insert_glyphs (struct frame *f, struct glyph *start, int len) | |||
| 918 | if (coding->produced > 0) | 919 | if (coding->produced > 0) |
| 919 | { | 920 | { |
| 920 | block_input (); | 921 | block_input (); |
| 921 | fwrite (conversion_buffer, 1, coding->produced, tty->output); | 922 | fwrite_unlocked (conversion_buffer, 1, coding->produced, tty->output); |
| 922 | if (ferror (tty->output)) | 923 | clearerr_unlocked (tty->output); |
| 923 | clearerr (tty->output); | ||
| 924 | if (tty->termscript) | 924 | if (tty->termscript) |
| 925 | fwrite (conversion_buffer, 1, coding->produced, tty->termscript); | 925 | fwrite_unlocked (conversion_buffer, 1, coding->produced, |
| 926 | tty->termscript); | ||
| 926 | unblock_input (); | 927 | unblock_input (); |
| 927 | } | 928 | } |
| 928 | 929 | ||
| @@ -3327,7 +3328,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3327 | which calls tty_show_cursor. Re-hide it, so it doesn't show | 3328 | which calls tty_show_cursor. Re-hide it, so it doesn't show |
| 3328 | through the menus. */ | 3329 | through the menus. */ |
| 3329 | tty_hide_cursor (tty); | 3330 | tty_hide_cursor (tty); |
| 3330 | fflush (tty->output); | 3331 | fflush_unlocked (tty->output); |
| 3331 | } | 3332 | } |
| 3332 | 3333 | ||
| 3333 | sf->mouse_moved = 0; | 3334 | sf->mouse_moved = 0; |
| @@ -3335,7 +3336,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3335 | while (statecount--) | 3336 | while (statecount--) |
| 3336 | free_saved_screen (state[statecount].screen_behind); | 3337 | free_saved_screen (state[statecount].screen_behind); |
| 3337 | tty_show_cursor (tty); /* Turn cursor back on. */ | 3338 | tty_show_cursor (tty); /* Turn cursor back on. */ |
| 3338 | fflush (tty->output); | 3339 | fflush_unlocked (tty->output); |
| 3339 | 3340 | ||
| 3340 | /* Clean up any mouse events that are waiting inside Emacs event queue. | 3341 | /* Clean up any mouse events that are waiting inside Emacs event queue. |
| 3341 | These events are likely to be generated before the menu was even | 3342 | These events are likely to be generated before the menu was even |
diff --git a/src/xfaces.c b/src/xfaces.c index 4714b7b3cb8..86bb9b0b496 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -6232,7 +6232,7 @@ where R,G,B are numbers between 0 and 255 and name is an arbitrary string. */) | |||
| 6232 | int red, green, blue; | 6232 | int red, green, blue; |
| 6233 | int num; | 6233 | int num; |
| 6234 | 6234 | ||
| 6235 | while (fgets (buf, sizeof (buf), fp) != NULL) { | 6235 | while (fgets_unlocked (buf, sizeof (buf), fp) != NULL) { |
| 6236 | if (sscanf (buf, "%d %d %d %n", &red, &green, &blue, &num) == 3) | 6236 | if (sscanf (buf, "%d %d %d %n", &red, &green, &blue, &num) == 3) |
| 6237 | { | 6237 | { |
| 6238 | #ifdef HAVE_NTGUI | 6238 | #ifdef HAVE_NTGUI |