]> code.delx.au - gnu-emacs/commitdiff
Move Vlibrary_cache to emacs.c and reset before dumping.
authorJuanma Barranquero <lekktu@gmail.com>
Tue, 25 Sep 2012 11:57:30 +0000 (13:57 +0200)
committerJuanma Barranquero <lekktu@gmail.com>
Tue, 25 Sep 2012 11:57:30 +0000 (13:57 +0200)
* 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] <Vlibrary_cache>: 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) <Vlibrary_cache>: Do not initialize.

* src/w32.h (Vlibrary_cache): Do not declare.

src/ChangeLog
src/emacs.c
src/image.c
src/lisp.h
src/w32.c
src/w32.h

index 9d048beeec144420c20e1926f5947e25037af678..1b0668860b990f2aa29b1e57adeaa54236b0b295 100644 (file)
@@ -1,3 +1,21 @@
+2012-09-25  Juanma Barranquero  <lekktu@gmail.com>
+
+       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] <Vlibrary_cache>: 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) <Vlibrary_cache>: Do not initialize.
+
+       * w32.h (Vlibrary_cache): Do not declare.
+
 2012-09-25  Eli Zaretskii  <eliz@gnu.org>
 
        * w32proc.c (sys_signal): Handle all signals defined by the
index 686a884cdbb0c043ea33e6dca9895b8749b1f159..5aae812b869e4273341348fb7f85e72ac52abd6e 100644 (file)
@@ -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;
 }
index b9adf4ad480581bbee50111904fbeb0573982a0d..7901b95f236ee419bfc3dce227b92c1afd2edd7b 100644 (file)
@@ -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
index 665ed17dfd0c5313eeb06bda209c9e7657b28506..35efa67e7073651dced5111fb5083519e4c72f0d 100644 (file)
@@ -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);
index f7e16354791708c34779b15b1f32f9ecc67cb867..3154c725abf209172543b74a419a32eda3f177e4 100644 (file)
--- a/src/w32.c
+++ b/src/w32.c
@@ -6521,10 +6521,6 @@ sys_localtime (const time_t *t)
 
 
 \f
-/* 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;
index 18625cea9557ab5cd790eee6eca6d8d9ffccfab9..a833c8f4315f510810b24f126596d392bfefdfd9 100644 (file)
--- 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