Various detailed fixes to minibuf.c, etc., to fix bug #48337
Also fix some unsafe coding.
* lisp/window.el (push-window-buffer-onto-prev): New function, extracted from
(record-window-buffer): Refactor by extracting the above, and removing the now
redundant parameter DO-MINIBUF.
* src/minibuf.c (zip_minibuffer_stacks, read_minibuf): Replace calls to
get_minibuffer (0) by nth_minibuffer (0). Replace calls to
Qrecord_window_buffer by calls to Qpush_window_buffer_onto_prev.
(Factive_minibuffer_window, read_minibuf_unwind): Call abort_emacs should an
"impossible" null value be returned by nth_minibuffer.
(read_minibuf): Move the get_minibuffer_call to just after the incrementation
of minibuf_level as a precaution against a missing buffer in
Vminibuffer_list.
(nth_minibuffer): Replace XCAR by Fcar, to allow (car nil) to work.
(init_minibuf_once): Create the inactive buffer *Minibuf-0*.
(syms_of_minibuf): New DEFSYM, Qpush_window_buffer_onto_prev.
* src/window.c (restore_window_configuration): Replace some XCARs and XCDRs
by Fcar_safe and Fcdr_safe.