From aa15c6bb4fec3c36efe1c05000e05faa6a483038 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Tue, 25 Sep 2012 13:57:30 +0200 Subject: [PATCH] Move Vlibrary_cache to emacs.c and reset before dumping. * src/lisp.h (reset_image_types): Declare. [WINDOWSNT] (Vlibrary_cache): Declare. * src/image.c (reset_image_types): New function. * src/emacs.c [WINDOWSNT] (Vlibrary_cache): Move from w32.c. (syms_of_emacs) [WINDOWSNT] : Initialize and staticpro. (Fdump_emacs): Reset Vlibrary_cache and image_types. * src/w32.c (Vlibrary_cache): Do not define; moved to emacs.c (globals_of_w32) : Do not initialize. * src/w32.h (Vlibrary_cache): Do not declare. --- src/ChangeLog | 18 ++++++++++++++++++ src/emacs.c | 17 +++++++++++++++++ src/image.c | 18 +++++++++++++++--- src/lisp.h | 4 ++++ src/w32.c | 7 ------- src/w32.h | 2 +- 6 files changed, 55 insertions(+), 11 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 9d048beeec..1b0668860b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,21 @@ +2012-09-25 Juanma Barranquero + + Move Vlibrary_cache to emacs.c and reset before dumping. + + * lisp.h (reset_image_types): Declare. + [WINDOWSNT] (Vlibrary_cache): Declare. + + * image.c (reset_image_types): New function. + + * emacs.c [WINDOWSNT] (Vlibrary_cache): Move from w32.c. + (syms_of_emacs) [WINDOWSNT] : Initialize and staticpro. + (Fdump_emacs): Reset Vlibrary_cache and image_types. + + * w32.c (Vlibrary_cache): Do not define; moved to emacs.c + (globals_of_w32) : Do not initialize. + + * w32.h (Vlibrary_cache): Do not declare. + 2012-09-25 Eli Zaretskii * w32proc.c (sys_signal): Handle all signals defined by the diff --git a/src/emacs.c b/src/emacs.c index 686a884cdb..5aae812b86 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -96,6 +96,11 @@ static const char emacs_copyright[] = COPYRIGHT; /* Empty lisp strings. To avoid having to build any others. */ Lisp_Object empty_unibyte_string, empty_multibyte_string; +#ifdef WINDOWSNT +/* Cache for externally loaded libraries. */ +Lisp_Object Vlibrary_cache; +#endif + /* Set after Emacs has started up the first time. Prevents reinitialization of the Lisp world and keymaps on subsequent starts. */ @@ -2025,6 +2030,13 @@ You must run Emacs in batch mode in order to dump it. */) free (malloc_state_ptr); #endif +#ifdef WINDOWSNT + Vlibrary_cache = Qnil; +#endif +#ifdef HAVE_WINDOW_SYSTEM + reset_image_types (); +#endif + Vpurify_flag = tem; return unbind_to (count, Qnil); @@ -2357,6 +2369,11 @@ libraries; only those already known by Emacs will be loaded. */); Vdynamic_library_alist = Qnil; Fput (intern_c_string ("dynamic-library-alist"), Qrisky_local_variable, Qt); +#ifdef WINDOWSNT + Vlibrary_cache = Qnil; + staticpro (&Vlibrary_cache); +#endif + /* Make sure IS_DAEMON starts up as false. */ daemon_pipe[1] = 0; } diff --git a/src/image.c b/src/image.c index b9adf4ad48..7901b95f23 100644 --- a/src/image.c +++ b/src/image.c @@ -8831,12 +8831,24 @@ lookup_image_type (Lisp_Object type) return NULL; } +/* Reset image_types before dumping. + Called from Fdump_emacs. */ + +void +reset_image_types (void) +{ + while (image_types) + { + struct image_type *next = image_types->next; + xfree (image_types); + image_types = next; + } +} + void syms_of_image (void) { - /* Initialize this only once, since that's what we do with Vimage_types - and they are supposed to be in sync. Initializing here gives correct - operation on GNU/Linux of calling dump-emacs after loading some images. */ + /* Initialize this only once; it will be reset before dumping. */ image_types = NULL; /* Must be defined now because we're going to update it below, while diff --git a/src/lisp.h b/src/lisp.h index 665ed17dfd..35efa67e70 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2731,6 +2731,7 @@ extern void init_fringe_once (void); extern Lisp_Object QCascent, QCmargin, QCrelief; extern Lisp_Object QCconversion; extern int x_bitmap_mask (struct frame *, ptrdiff_t); +extern void reset_image_types (void); extern void syms_of_image (void); /* Defined in insdel.c. */ @@ -3284,6 +3285,9 @@ extern Lisp_Object empty_unibyte_string, empty_multibyte_string; extern Lisp_Object Qfile_name_handler_alist; extern _Noreturn void terminate_due_to_signal (int, int); extern Lisp_Object Qkill_emacs; +#ifdef WINDOWSNT +extern Lisp_Object Vlibrary_cache; +#endif #if HAVE_SETLOCALE void fixup_locale (void); void synchronize_system_messages_locale (void); diff --git a/src/w32.c b/src/w32.c index f7e1635479..3154c725ab 100644 --- a/src/w32.c +++ b/src/w32.c @@ -6521,10 +6521,6 @@ sys_localtime (const time_t *t) -/* Delayed loading of libraries. */ - -Lisp_Object Vlibrary_cache; - /* Try loading LIBRARY_ID from the file(s) specified in Vdynamic_library_alist. If the library is loaded successfully, return the handle of the DLL, and record the filename in the @@ -6769,9 +6765,6 @@ globals_of_w32 (void) DEFSYM (QCloaded_from, ":loaded-from"); - Vlibrary_cache = Qnil; - staticpro (&Vlibrary_cache); - g_b_init_is_windows_9x = 0; g_b_init_open_process_token = 0; g_b_init_get_token_information = 0; diff --git a/src/w32.h b/src/w32.h index 18625cea95..a833c8f431 100644 --- a/src/w32.h +++ b/src/w32.h @@ -145,7 +145,7 @@ extern void check_windows_init_file (void); extern int _sys_read_ahead (int fd); extern int _sys_wait_accept (int fd); -extern Lisp_Object Vlibrary_cache, QCloaded_from; +extern Lisp_Object QCloaded_from; extern HMODULE w32_delayed_load (Lisp_Object); #ifdef HAVE_GNUTLS -- 2.20.1