emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r116021: Fix MinGW64 porting problem with _setjmp.


From: Paul Eggert
Subject: [Emacs-diffs] trunk r116021: Fix MinGW64 porting problem with _setjmp.
Date: Tue, 14 Jan 2014 01:19:45 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116021
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Mon 2014-01-13 17:19:42 -0800
message:
  Fix MinGW64 porting problem with _setjmp.
  
  Reported by Eli Zaretskii in:
  http://lists.gnu.org/archive/html/emacs-devel/2014-01/msg01297.html
  * image.c (FAST_SETJMP, FAST_LONGJMP): New macros, replacing
  the old _setjmp and _longjmp.  All uses changed.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/image.c                    image.c-20091113204419-o5vbwnq5f7feedwu-2969
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-01-13 23:41:43 +0000
+++ b/src/ChangeLog     2014-01-14 01:19:42 +0000
@@ -1,3 +1,11 @@
+2014-01-14  Paul Eggert  <address@hidden>
+
+       Fix MinGW64 porting problem with _setjmp.
+       Reported by Eli Zaretskii in:
+       http://lists.gnu.org/archive/html/emacs-devel/2014-01/msg01297.html
+       * image.c (FAST_SETJMP, FAST_LONGJMP): New macros, replacing
+       the old _setjmp and _longjmp.  All uses changed.
+
 2014-01-13  Daniel Colascione  <address@hidden>
 
        * textprop.c (Fremove_list_of_text_properties): Correctly

=== modified file 'src/image.c'
--- a/src/image.c       2014-01-07 21:14:32 +0000
+++ b/src/image.c       2014-01-14 01:19:42 +0000
@@ -5608,24 +5608,26 @@
 
 #endif /* WINDOWSNT */
 
-/* Possibly inefficient/inexact substitutes for _setjmp and _longjmp.
-   Do not use sys_setjmp, as PNG supports only jmp_buf.  The _longjmp
-   substitute may munge the signal mask, but that should be OK here.
-   MinGW (MS-Windows) uses _setjmp and defines setjmp to _setjmp in
-   the system header setjmp.h; don't mess up that.  */
-#ifndef HAVE__SETJMP
-# define _setjmp(j) setjmp (j)
-# define _longjmp longjmp
+/* Fast implementations of setjmp and longjmp.  Although setjmp and longjmp
+   will do, POSIX _setjmp and _longjmp (if available) are often faster.
+   Do not use sys_setjmp, as PNG supports only jmp_buf.
+   It's OK if the longjmp substitute restores the signal mask.  */
+#ifdef HAVE__SETJMP
+# define FAST_SETJMP(j) _setjmp (j)
+# define FAST_LONGJMP _longjmp
+#else
+# define FAST_SETJMP(j) setjmp (j)
+# define FAST_LONGJMP longjmp
 #endif
 
-#if (PNG_LIBPNG_VER < 10500)
-#define PNG_LONGJMP(ptr) (_longjmp ((ptr)->jmpbuf, 1))
+#if PNG_LIBPNG_VER < 10500
+#define PNG_LONGJMP(ptr) FAST_LONGJMP ((ptr)->jmpbuf, 1)
 #define PNG_JMPBUF(ptr) ((ptr)->jmpbuf)
 #else
 /* In libpng version 1.5, the jmpbuf member is hidden. (Bug#7908)  */
-#define PNG_LONGJMP(ptr) (fn_png_longjmp ((ptr), 1))
+#define PNG_LONGJMP(ptr) fn_png_longjmp (ptr, 1)
 #define PNG_JMPBUF(ptr) \
-  (*fn_png_set_longjmp_fn ((ptr), _longjmp, sizeof (jmp_buf)))
+  (*fn_png_set_longjmp_fn (ptr, FAST_LONGJMP, sizeof (jmp_buf)))
 #endif
 
 /* Error and warning handlers installed when the PNG library
@@ -5810,7 +5812,7 @@
 
   /* Set error jump-back.  We come back here when the PNG library
      detects an error.  */
-  if (_setjmp (PNG_JMPBUF (png_ptr)))
+  if (FAST_SETJMP (PNG_JMPBUF (png_ptr)))
     {
     error:
       if (c->png_ptr)


reply via email to

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