emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110153: Remove LIBRARIES arg from w3


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110153: Remove LIBRARIES arg from w32_delayed_load and friends.
Date: Sun, 23 Sep 2012 17:16:57 +0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110153
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sun 2012-09-23 17:16:57 +0800
message:
  Remove LIBRARIES arg from w32_delayed_load and friends.
  These always use Vdynamic_library_alist anyway.
  
  * src/image.c (Finit_image_library, lookup_image_type)
  (define_image_type): Remove now-unneeded second arg.
  (init_xpm_functions, init_png_functions, init_jpeg_functions)
  (init_tiff_functions, init_gif_functions, init_svg_functions):
  Arglist and w32_delayed_load calling convention changed.
  (gs_type): Remove init_gs_functions; there is no such function.
  
  * src/gnutls.c (init_gnutls_functions): Caller changed; remove arg.
  (Fgnutls_available_p): Caller changed.
  
  * src/xml.c (init_libxml2_functions, Flibxml_parse_html_region)
  (Flibxml_parse_xml_region): Likewise.
  
  * src/dispextern.h (struct image_type): Remove arg from init function.
  
  * src/w32.c (w32_delayed_load): Remove LIBRARIES argument; always use
  Vdynamic_library_alist.
  
  * lisp/image.el (image-type-available-p): Change caller to
  init-image-library.
modified:
  lisp/ChangeLog
  lisp/image.el
  src/ChangeLog
  src/dispextern.h
  src/gnutls.c
  src/image.c
  src/w32.c
  src/w32.h
  src/xml.c
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-09-22 22:57:11 +0000
+++ b/lisp/ChangeLog    2012-09-23 09:16:57 +0000
@@ -1,3 +1,8 @@
+2012-09-23  Chong Yidong  <address@hidden>
+
+       * image.el (image-type-available-p): Adapt to init-image-library
+       argument changes.
+
 2012-09-22  Juri Linkov  <address@hidden>
 
        * dired.el (dired-mode-map): Add [remap read-only-mode] for

=== modified file 'lisp/image.el'
--- a/lisp/image.el     2012-09-13 06:09:45 +0000
+++ b/lisp/image.el     2012-09-23 09:16:57 +0000
@@ -346,7 +346,7 @@
   "Return non-nil if image type TYPE is available.
 Image types are symbols like `xbm' or `jpeg'."
   (and (fboundp 'init-image-library)
-       (init-image-library type dynamic-library-alist)))
+       (init-image-library type)))
 
 
 ;;;###autoload

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-09-23 08:44:20 +0000
+++ b/src/ChangeLog     2012-09-23 09:16:57 +0000
@@ -1,3 +1,23 @@
+2012-09-23  Chong Yidong  <address@hidden>
+
+       * w32.c (w32_delayed_load): Remove LIBRARIES argument; always use
+       Vdynamic_library_alist.
+
+       * gnutls.c (init_gnutls_functions): Caller changed; remove arg.
+       (Fgnutls_available_p): Caller changed.
+
+       * xml.c (init_libxml2_functions, Flibxml_parse_html_region)
+       (Flibxml_parse_xml_region): Likewise.
+
+       * dispextern.h (struct image_type): Remove arg from init function.
+
+       * image.c (Finit_image_library, lookup_image_type)
+       (define_image_type): Remove now-unneeded second arg.
+       (init_xpm_functions, init_png_functions, init_jpeg_functions)
+       (init_tiff_functions, init_gif_functions, init_svg_functions):
+       Arglist and w32_delayed_load calling convention changed.
+       (gs_type): Remove init_gs_functions; there is no such function.
+
 2012-09-23  Paul Eggert  <address@hidden>
 
        Simplify and avoid signal-handling races (Bug#12471).

=== modified file 'src/dispextern.h'
--- a/src/dispextern.h  2012-09-22 14:10:24 +0000
+++ b/src/dispextern.h  2012-09-23 09:16:57 +0000
@@ -2769,7 +2769,7 @@
 
   /* Initialization function (used for dynamic loading of image
      libraries on Windows), or NULL if none.  */
-  int (* init) (Lisp_Object);
+  int (* init) (void);
 
   /* Next in list of all supported image types.  */
   struct image_type *next;

=== modified file 'src/gnutls.c'
--- a/src/gnutls.c      2012-09-15 07:06:56 +0000
+++ b/src/gnutls.c      2012-09-23 09:16:57 +0000
@@ -142,12 +142,12 @@
 DEF_GNUTLS_FN (int, gnutls_x509_crt_init, (gnutls_x509_crt_t *));
 
 static int
-init_gnutls_functions (Lisp_Object libraries)
+init_gnutls_functions (void)
 {
   HMODULE library;
   int max_log_level = 1;
 
-  if (!(library = w32_delayed_load (libraries, Qgnutls_dll)))
+  if (!(library = w32_delayed_load (Qgnutls_dll)))
     {
       GNUTLS_LOG (1, max_log_level, "GnuTLS library not found");
       return 0;
@@ -656,7 +656,7 @@
   else
     {
       Lisp_Object status;
-      status = init_gnutls_functions (Vdynamic_library_alist) ? Qt : Qnil;
+      status = init_gnutls_functions () ? Qt : Qnil;
       Vlibrary_cache = Fcons (Fcons (Qgnutls_dll, status), Vlibrary_cache);
       return status;
     }

=== modified file 'src/image.c'
--- a/src/image.c       2012-09-23 08:44:20 +0000
+++ b/src/image.c       2012-09-23 09:16:57 +0000
@@ -579,15 +579,10 @@
   do { Vimage_types = Fcons (type, Vimage_types); } while (0)
 
 /* Define a new image type from TYPE.  This adds a copy of TYPE to
-   image_types and caches the loading status of TYPE.
-
-   LIBRARIES is an alist associating dynamic libraries to external
-   files implementing them, which is passed to the image library
-   initialization function if necessary.  A nil value defaults to
-   Vdynamic_library_alist.  */
+   image_types and caches the loading status of TYPE.  */
 
 static struct image_type *
-define_image_type (struct image_type *type, Lisp_Object libraries)
+define_image_type (struct image_type *type)
 {
   struct image_type *p = NULL;
   Lisp_Object target_type = *type->type;
@@ -609,7 +604,7 @@
       else
 #endif
        {
-         type_valid = type->init (libraries);
+         type_valid = type->init ();
          CACHE_IMAGE_TYPE (target_type, type_valid ? Qt : Qnil);
        }
     }
@@ -3053,7 +3048,7 @@
 };
 
 #ifdef HAVE_NTGUI
-static int init_xpm_functions (Lisp_Object);
+static int init_xpm_functions (void);
 #else
 #define init_xpm_functions NULL
 #endif
@@ -3267,11 +3262,11 @@
 DEF_IMGLIB_FN (void, XImageFree, (xpm_XImage *));
 
 static int
-init_xpm_functions (Lisp_Object libraries)
+init_xpm_functions (void)
 {
   HMODULE library;
 
-  if (!(library = w32_delayed_load (libraries, Qxpm)))
+  if (!(library = w32_delayed_load (Qxpm)))
     return 0;
 
   LOAD_IMGLIB_FN (library, XpmFreeAttributes);
@@ -5397,7 +5392,7 @@
 };
 
 #ifdef HAVE_NTGUI
-static int init_png_functions (Lisp_Object);
+static int init_png_functions (void);
 #else
 #define init_png_functions NULL
 #endif
@@ -5469,11 +5464,11 @@
 #endif /* libpng version >= 1.5 */
 
 static int
-init_png_functions (Lisp_Object libraries)
+init_png_functions (void)
 {
   HMODULE library;
 
-  if (!(library = w32_delayed_load (libraries, Qpng)))
+  if (!(library = w32_delayed_load (Qpng)))
     return 0;
 
   LOAD_IMGLIB_FN (library, png_get_io_ptr);
@@ -6056,7 +6051,7 @@
 };
 
 #ifdef HAVE_NTGUI
-static int init_jpeg_functions (Lisp_Object);
+static int init_jpeg_functions (void);
 #else
 #define init_jpeg_functions NULL
 #endif
@@ -6125,11 +6120,11 @@
 DEF_IMGLIB_FN (boolean, jpeg_resync_to_restart, (j_decompress_ptr, int));
 
 static int
-init_jpeg_functions (Lisp_Object libraries)
+init_jpeg_functions (void)
 {
   HMODULE library;
 
-  if (!(library = w32_delayed_load (libraries, Qjpeg)))
+  if (!(library = w32_delayed_load (Qjpeg)))
     return 0;
 
   LOAD_IMGLIB_FN (library, jpeg_finish_decompress);
@@ -6648,7 +6643,7 @@
 };
 
 #ifdef HAVE_NTGUI
-static int init_tiff_functions (Lisp_Object);
+static int init_tiff_functions (void);
 #else
 #define init_tiff_functions NULL
 #endif
@@ -6702,11 +6697,11 @@
 DEF_IMGLIB_FN (int, TIFFSetDirectory, (TIFF *, tdir_t));
 
 static int
-init_tiff_functions (Lisp_Object libraries)
+init_tiff_functions (void)
 {
   HMODULE library;
 
-  if (!(library = w32_delayed_load (libraries, Qtiff)))
+  if (!(library = w32_delayed_load (Qtiff)))
     return 0;
 
   LOAD_IMGLIB_FN (library, TIFFSetErrorHandler);
@@ -7103,7 +7098,7 @@
 };
 
 #ifdef HAVE_NTGUI
-static int init_gif_functions (Lisp_Object);
+static int init_gif_functions (void);
 #else
 #define init_gif_functions NULL
 #endif
@@ -7175,11 +7170,11 @@
 DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *));
 
 static int
-init_gif_functions (Lisp_Object libraries)
+init_gif_functions (void)
 {
   HMODULE library;
 
-  if (!(library = w32_delayed_load (libraries, Qgif)))
+  if (!(library = w32_delayed_load (Qgif)))
     return 0;
 
   LOAD_IMGLIB_FN (library, DGifCloseFile);
@@ -7600,7 +7595,7 @@
   };
 
 #ifdef HAVE_NTGUI
-static int init_imagemagick_functions (Lisp_Object);
+static int init_imagemagick_functions (void);
 #else
 #define init_imagemagick_functions NULL
 #endif
@@ -8154,7 +8149,7 @@
 };
 
 #ifdef HAVE_NTGUI
-static int init_svg_functions (Lisp_Object);
+static int init_svg_functions (void);
 #else
 #define init_svg_functions NULL
 #endif
@@ -8218,14 +8213,14 @@
 Lisp_Object Qgdk_pixbuf, Qglib, Qgobject;
 
 static int
-init_svg_functions (Lisp_Object libraries)
+init_svg_functions (void)
 {
   HMODULE library, gdklib, glib, gobject;
 
-  if (!(glib = w32_delayed_load (libraries, Qglib))
-      || !(gobject = w32_delayed_load (libraries, Qgobject))
-      || !(gdklib = w32_delayed_load (libraries, Qgdk_pixbuf))
-      || !(library = w32_delayed_load (libraries, Qsvg)))
+  if (!(glib = w32_delayed_load (Qglib))
+      || !(gobject = w32_delayed_load (Qgobject))
+      || !(gdklib = w32_delayed_load (Qgdk_pixbuf))
+      || !(library = w32_delayed_load (Qsvg)))
     return 0;
 
   LOAD_IMGLIB_FN (library, rsvg_handle_new);
@@ -8549,12 +8544,6 @@
   {":background",      IMAGE_STRING_OR_NIL_VALUE,              0}
 };
 
-#ifdef HAVE_NTGUI
-static int init_gs_functions (Lisp_Object);
-#else
-#define init_gs_functions NULL
-#endif
-
 /* Structure describing the image type `ghostscript'.  */
 
 static struct image_type gs_type =
@@ -8563,7 +8552,7 @@
   gs_image_p,
   gs_load,
   gs_clear_image,
-  init_gs_functions,
+  NULL,
   NULL
 };
 
@@ -8826,77 +8815,69 @@
                            Initialization
  ***********************************************************************/
 
-DEFUN ("init-image-library", Finit_image_library, Sinit_image_library, 2, 2, 0,
+DEFUN ("init-image-library", Finit_image_library, Sinit_image_library, 1, 1, 0,
        doc: /* Initialize image library implementing image type TYPE.
 Return non-nil if TYPE is a supported image type.
 
-Image types pbm and xbm are prebuilt; other types are loaded here.
-Libraries to load are specified in alist LIBRARIES (usually, the value
-of `dynamic-library-alist', which see).  */)
-  (Lisp_Object type, Lisp_Object libraries)
+If image libraries are loaded dynamically (currently only the case on
+MS-Windows), load the library for TYPE if it is not yet loaded, using
+the library file(s) specified by `dynamic-library-alist'.  */)
+  (Lisp_Object type)
 {
-  return lookup_image_type (type, libraries) ? Qt : Qnil;
+  return lookup_image_type (type) ? Qt : Qnil;
 }
 
 /* Look up image type TYPE, and return a pointer to its image_type
-   structure.  Return 0 if TYPE is not a known image type.
-
-   LIBRARIES is an alist associating dynamic libraries to external
-   files implementing them, which is passed to the image library
-   initialization function if necessary.  A nil value defaults to
-   Vdynamic_library_alist.  */
+   structure.  Return 0 if TYPE is not a known image type.  */
 
 static struct image_type *
-lookup_image_type (Lisp_Object type, Lisp_Object libraries)
+lookup_image_type (Lisp_Object type)
 {
-  if (NILP (libraries))
-    libraries = Vdynamic_library_alist;
-
   /* Types pbm and xbm are built-in and always available.  */
   if (EQ (type, Qpbm))
-    return define_image_type (&pbm_type, libraries);
+    return define_image_type (&pbm_type);
 
   if (EQ (type, Qxbm))
-    return define_image_type (&xbm_type, libraries);
+    return define_image_type (&xbm_type);
 
 #if defined (HAVE_XPM) || defined (HAVE_NS)
   if (EQ (type, Qxpm))
-    return define_image_type (&xpm_type, libraries);
+    return define_image_type (&xpm_type);
 #endif
 
 #if defined (HAVE_JPEG) || defined (HAVE_NS)
   if (EQ (type, Qjpeg))
-    return define_image_type (&jpeg_type, libraries);
+    return define_image_type (&jpeg_type);
 #endif
 
 #if defined (HAVE_TIFF) || defined (HAVE_NS)
   if (EQ (type, Qtiff))
-    return define_image_type (&tiff_type, libraries);
+    return define_image_type (&tiff_type);
 #endif
 
 #if defined (HAVE_GIF) || defined (HAVE_NS)
   if (EQ (type, Qgif))
-    return define_image_type (&gif_type, libraries);
+    return define_image_type (&gif_type);
 #endif
 
 #if defined (HAVE_PNG) || defined (HAVE_NS)
   if (EQ (type, Qpng))
-    return define_image_type (&png_type, libraries);
+    return define_image_type (&png_type);
 #endif
 
 #if defined (HAVE_RSVG)
   if (EQ (type, Qsvg))
-    return define_image_type (&svg_type, libraries);
+    return define_image_type (&svg_type);
 #endif
 
 #if defined (HAVE_IMAGEMAGICK)
   if (EQ (type, Qimagemagick))
-    return define_image_type (&imagemagick_type, libraries);
+    return define_image_type (&imagemagick_type);
 #endif
 
 #ifdef HAVE_GHOSTSCRIPT
   if (EQ (type, Qpostscript))
-    return define_image_type (&gs_type, libraries);
+    return define_image_type (&gs_type);
 #endif
 
   return NULL;

=== modified file 'src/w32.c'
--- a/src/w32.c 2012-09-15 08:03:11 +0000
+++ b/src/w32.c 2012-09-23 09:16:57 +0000
@@ -6525,29 +6525,27 @@
 
 Lisp_Object Vlibrary_cache;
 
-/* The argument LIBRARIES is an alist that associates a symbol
-   LIBRARY_ID, identifying an external DLL library known to Emacs, to
-   a list of filenames under which the library is usually found.  In
-   most cases, the argument passed as LIBRARIES is the variable
-   `dynamic-library-alist', which is initialized to a list of common
-   library names.  If the function loads the library successfully, it
-   returns the handle of the DLL, and records the filename in the
-   property :loaded-from of LIBRARY_ID; it returns NULL if the library
-   could not be found, or when it was already loaded (because the
-   handle is not recorded anywhere, and so is lost after use).  It
-   would be trivial to save the handle too in :loaded-from, but
-   currently there's no use case for it.  */
+/* 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
+   property :loaded-from of LIBRARY_ID.  If the library could not be
+   found, or when it was already loaded (because the handle is not
+   recorded anywhere, and so is lost after use), return NULL.
+
+   We could also save the handle in :loaded-from, but currently
+   there's no use case for it.  */
 HMODULE
-w32_delayed_load (Lisp_Object libraries, Lisp_Object library_id)
+w32_delayed_load (Lisp_Object library_id)
 {
   HMODULE library_dll = NULL;
 
   CHECK_SYMBOL (library_id);
 
-  if (CONSP (libraries) && NILP (Fassq (library_id, Vlibrary_cache)))
+  if (CONSP (Vdynamic_library_alist)
+      && NILP (Fassq (library_id, Vlibrary_cache)))
     {
       Lisp_Object found = Qnil;
-      Lisp_Object dlls = Fassq (library_id, libraries);
+      Lisp_Object dlls = Fassq (library_id, Vdynamic_library_alist);
 
       if (CONSP (dlls))
         for (dlls = XCDR (dlls); CONSP (dlls); dlls = XCDR (dlls))

=== modified file 'src/w32.h'
--- a/src/w32.h 2012-08-04 14:17:10 +0000
+++ b/src/w32.h 2012-09-23 09:16:57 +0000
@@ -146,7 +146,7 @@
 extern int _sys_wait_accept (int fd);
 
 extern Lisp_Object Vlibrary_cache, QCloaded_from;
-extern HMODULE w32_delayed_load (Lisp_Object, Lisp_Object);
+extern HMODULE w32_delayed_load (Lisp_Object);
 
 #ifdef HAVE_GNUTLS
 #include <gnutls/gnutls.h>

=== modified file 'src/xml.c'
--- a/src/xml.c 2012-09-15 07:06:56 +0000
+++ b/src/xml.c 2012-09-23 09:16:57 +0000
@@ -82,7 +82,7 @@
 #endif /* !WINDOWSNT */
 
 static int
-init_libxml2_functions (Lisp_Object libraries)
+init_libxml2_functions (void)
 {
 #ifdef WINDOWSNT
   if (libxml2_loaded_p ())
@@ -91,7 +91,7 @@
     {
       HMODULE library;
 
-      if (!(library = w32_delayed_load (libraries, Qlibxml2_dll)))
+      if (!(library = w32_delayed_load (Qlibxml2_dll)))
        {
          message ("%s", "libxml2 library not found");
          return 0;
@@ -257,7 +257,7 @@
 If BASE-URL is non-nil, it is used to expand relative URLs.  */)
   (Lisp_Object start, Lisp_Object end, Lisp_Object base_url)
 {
-  if (init_libxml2_functions (Vdynamic_library_alist))
+  if (init_libxml2_functions ())
     return parse_region (start, end, base_url, 1);
   return Qnil;
 }
@@ -269,7 +269,7 @@
 If BASE-URL is non-nil, it is used to expand relative URLs.  */)
   (Lisp_Object start, Lisp_Object end, Lisp_Object base_url)
 {
-  if (init_libxml2_functions (Vdynamic_library_alist))
+  if (init_libxml2_functions ())
     return parse_region (start, end, base_url, 0);
   return Qnil;
 }


reply via email to

[Prev in Thread] Current Thread [Next in Thread]