1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Speed up low-level parts of the reader and refactor

Inspect the given 'readcharfun' source once, before using it, instead of
for each character read.  This moves a bunch of branches away from the
critical path, with separate functions for different source types.
Replace some preprocessor macros with functions.

* src/lread.c (READCHAR, UNREAD, READCHAR_REPORT_MULTIBYTE)
(FROM_FILE_P): Remove; use corresponding functions instead.
All callers adapted.
(source_t): New struct that takes the place of the `readcharfun` and
`readbyte` arguments in many places.
(init_source)
(source_buffer_get, source_buffer_unget)
(source_marker_get, source_marker_unget)
(source_string_get, source_string_unget)
(source_file_get, source_file_unget)
(source_function_get, source_function_unget)
(from_file_p, unreadbyte_from_file):
New.
(readbyte_from_stdio): Replace `readbyte_from_file`.
(readchar, unreadchar): Rewrite.
(lisp_file_lexical_cookie, readevalloop, read_internal_start):
Create a source_t for use during reading.  All signatures and functions
called adapted.
(read_char_escape): Remove check for an error that can no longer occur.
This commit is contained in:
Mattias Engdegård 2024-05-26 13:44:32 +02:00
parent 99080d0c04
commit cd3727f7e0

File diff suppressed because it is too large Load diff