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.
(cherry picked from commit
cd3727f7e0607a152a97b534ee09a2cb8ac6cb84)