diff options
| author | Paul Eggert | 2019-07-08 17:50:39 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-07-08 17:50:39 -0700 |
| commit | f8ab90839fe64b2ec8b398a50e8fb4f33e8e95e1 (patch) | |
| tree | c3909d7ae6d78c78cc9e293c20cd764f49931bc2 /src/cm.c | |
| parent | 7b70efb740a04517e2764b0986c6e92305c1dd3e (diff) | |
| download | emacs-f8ab90839fe64b2ec8b398a50e8fb4f33e8e95e1.tar.gz emacs-f8ab90839fe64b2ec8b398a50e8fb4f33e8e95e1.zip | |
Use fewer locks when accessing stdio
* src/alloc.c, src/bidi.c, src/emacs-module.c, src/pdumper.c:
* src/regex-emacs.c, src/unexhp9k800.c, src/unexmacosx.c:
* src/widget.c, src/xdisp.c, src/xselect.c, src/xterm.c:
Include sysstdio.h instead of stdio.h, to avoid locking
stdio streams in many cases.
* src/alloc.c (test_setjmp):
* src/bidi.c (bidi_dump_cached_states):
* src/cm.c (calccost):
* src/dispnew.c (init_display_interactive):
* src/emacs.c (main):
* src/image.c (convert_mono_to_color_image):
* src/minibuf.c (read_minibuf_noninteractive):
* src/nsfont.m (ns_descriptor_to_entity)
(ns_dump_glyphstring):
* src/nsterm.h (NSTRACE_MSG_NO_DASHES):
* src/nsterm.m (ns_mouse_position)
(sendEvent:, keyDown:, performDragOperation:):
* src/pdumper.c (dump_fingerprint, print_paths_to_root_1):
* src/print.c (debug_print):
* src/regex-emacs.c (debug_putchar, print_fastmap)
(print_partial_compiled_pattern, print_compiled_pattern)
(print_double_string, regex_compile):
* src/term.c (vfatal):
* src/unexhp9k800.c (read_header):
* src/unexmacosx.c (unexec_error):
* src/widget.c (EmacsFrameInitialize):
* src/xdisp.c (message_to_stderr, vmessage, dump_glyph_row)
(Fdump_glyph_matrix, Fdump_frame_glyph_matrix, dump_glyph_string):
* src/xfaces.c (Fdump_colors, Fdump_face):
* src/xselect.c (x_clipboard_manager_error_2):
* src/xterm.c (x_initialize):
* src/xwidget.c (WEBKIT_FN_INIT):
Prefer unlocked calls like fputs to locked calls like fprintf.
* src/charset.c (read_hex):
* src/cm.c (cmputc, cmcheckmagic):
* src/dispnew.c (update_frame, update_frame_with_menu)
(update_frame_1, Fsend_string_to_terminal, Fding)
(bitch_at_user):
* src/emacs.c (main, Fdump_emacs):
* src/emacs-module.c (module_abort):
* src/fileio.c (Fdo_auto_save):
* src/image.c (slurp_file)
(png_read_from_file, png_load_body, our_stdio_fill_input_buffer):
* src/keyboard.c (record_char, kbd_buffer_get_event)
(handle_interrupt):
* src/lread.c (readbyte_from_stdio, read1):
* src/minibuf.c (read_minibuf_noninteractive):
* src/print.c (printchar_to_stream, strout)
(Fredirect_debugging_output):
* src/sysdep.c (reset_sys_modes, close_output_streams)
(procfs_ttyname, procfs_get_total_memory):
* src/term.c (tty_ring_bell, tty_send_additional_strings)
(tty_set_terminal_modes, tty_reset_terminal_modes)
(tty_update_end, tty_clear_end_of_line, tty_write_glyphs)
(tty_write_glyphs_with_face, tty_insert_glyphs)
(tty_menu_activate):
* src/xfaces.c (Fx_load_color_file):
Simplify by using ordinary calls like putc to explicitly-unlocked
calls like putc_unlocked, since the ordinary calls are now
unlocked anyway.
* src/emacs.c (main, Fdump_emacs):
* src/pdumper.c (Fdump_emacs_portable):
Coalesce adjacent printfs.
* src/nsterm.h: Include sysstdio.h as this file’s macros rely on it.
* src/regex-emacs.c (print_compiled_pattern):
Omit redundant fflush.
* src/sysstdio.h: Include unlocked-io.h.
(clearerr_unlocked, feof_unlocked, ferror_unlocked)
(fflush_unlocked, fgets_unlocked, fputc_unlocked)
(fputs_unlocked, fread_unlocked, fwrite_unlocked)
(getc_unlocked, getchar_unlocked, putc_unlocked)
(putchar_unlocked): Remove these macros; now done by unlocked-io.h.
* src/xwidget.c: Include sysstdio.h.
Diffstat (limited to 'src/cm.c')
| -rw-r--r-- | src/cm.c | 16 |
1 files changed, 8 insertions, 8 deletions
| @@ -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_unlocked (c & 0177, current_tty->termscript); | 48 | putc (c & 0177, current_tty->termscript); |
| 49 | putc_unlocked (c & 0177, current_tty->output); | 49 | putc (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_unlocked ('\r', tty->termscript); | 120 | putc ('\r', tty->termscript); |
| 121 | putc_unlocked ('\r', tty->output); | 121 | putc ('\r', tty->output); |
| 122 | if (tty->termscript) | 122 | if (tty->termscript) |
| 123 | putc_unlocked ('\n', tty->termscript); | 123 | putc ('\n', tty->termscript); |
| 124 | putc_unlocked ('\n', tty->output); | 124 | putc ('\n', tty->output); |
| 125 | curX (tty) = 0; | 125 | curX (tty) = 0; |
| 126 | curY (tty)++; | 126 | curY (tty)++; |
| 127 | } | 127 | } |
| @@ -205,7 +205,7 @@ calccost (struct tty_display_info *tty, | |||
| 205 | p = tty->Wcm->cm_down, c = tty->Wcm->cc_down; | 205 | p = tty->Wcm->cm_down, c = tty->Wcm->cc_down; |
| 206 | if (c == BIG) { /* caint get thar from here */ | 206 | if (c == BIG) { /* caint get thar from here */ |
| 207 | if (doit) | 207 | if (doit) |
| 208 | printf ("OOPS"); | 208 | fputs ("OOPS", stdout); |
| 209 | return c; | 209 | return c; |
| 210 | } | 210 | } |
| 211 | totalcost = c * deltay; | 211 | totalcost = c * deltay; |
| @@ -288,7 +288,7 @@ dodelta: | |||
| 288 | if (c == BIG) { /* caint get thar from here */ | 288 | if (c == BIG) { /* caint get thar from here */ |
| 289 | fail: | 289 | fail: |
| 290 | if (doit) | 290 | if (doit) |
| 291 | printf ("OOPS"); | 291 | fputs ("OOPS", stdout); |
| 292 | return BIG; | 292 | return BIG; |
| 293 | } | 293 | } |
| 294 | totalcost += c * deltax; | 294 | totalcost += c * deltax; |