GraphicsMagick: Add macros to support GCC malloc attributes whic...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.19885.1664059940.11362.graphicsmagick-commit@lists.sourceforge.net>
changeset 8a53ac7bbab5 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=8a53ac7bbab5
summary: Add macros to support GCC malloc attributes which accept arguments.

diffstat:

 ChangeLog                              |   5 +++++
 VisualMagick/installer/inc/version.isx |   4 ++--
 magick/common.h                        |  18 ++++++++++++++++--
 magick/tempfile.h                      |   4 ++--
 magick/version.h                       |   4 ++--
 www/Changelog.html                     |   7 +++++++
 6 files changed, 34 insertions(+), 8 deletions(-)

diffs (115 lines):

diff -r 49b1b6dcb93f -r 8a53ac7bbab5 ChangeLog
--- a/ChangeLog	Wed Sep 21 15:17:32 2022 -0500
+++ b/ChangeLog	Sat Sep 24 17:52:07 2022 -0500
@@ -1,3 +1,8 @@
+2022-09-24  Bob Friesenhahn  <[email protected]>
+
+	* magick/common.h (MAGICK_FUNC_MALLOC_2ARG): Add macros to support
+	GCC malloc attributes which accept arguments.
+
 2022-09-18  Bob Friesenhahn  <[email protected]>
 
 	* www/formats.rst: Add AVIF image file format to the list.
diff -r 49b1b6dcb93f -r 8a53ac7bbab5 VisualMagick/installer/inc/version.isx
--- a/VisualMagick/installer/inc/version.isx	Wed Sep 21 15:17:32 2022 -0500
+++ b/VisualMagick/installer/inc/version.isx	Sat Sep 24 17:52:07 2022 -0500
@@ -10,5 +10,5 @@
 
 #define public MagickPackageName "GraphicsMagick"
 #define public MagickPackageVersion "1.4"
-#define public MagickPackageVersionAddendum ".020220918"
-#define public MagickPackageReleaseDate "snapshot-20220918"
+#define public MagickPackageVersionAddendum ".020220924"
+#define public MagickPackageReleaseDate "snapshot-20220924"
diff -r 49b1b6dcb93f -r 8a53ac7bbab5 magick/common.h
--- a/magick/common.h	Wed Sep 21 15:17:32 2022 -0500
+++ b/magick/common.h	Sat Sep 24 17:52:07 2022 -0500
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2009-2016 GraphicsMagick Group
+  Copyright (C) 2009-2022 GraphicsMagick Group
 
   This program is covered by multiple licenses, which are described in
   Copyright.txt. You should have received a copy of Copyright.txt with this
@@ -145,9 +145,17 @@
 #    if ((MAGICK_HAS_ATTRIBUTE(__malloc__)) || \
          (__GNUC__ >= 3))  /* 3.0+ */
 #      define MAGICK_FUNC_MALLOC MAGICK_ATTRIBUTE((__malloc__))
+#      if (__GNUC__ >= 11) /* Clang 15 does not support extended malloc attributes */
+/* #        warning "Using extended malloc attribute!" */
+#        define MAGICK_FUNC_MALLOC_1ARG(deallocator) MAGICK_ATTRIBUTE((__malloc__,__malloc__(deallocator)))
+#        define MAGICK_FUNC_MALLOC_2ARG(deallocator, ptrindex) MAGICK_ATTRIBUTE((__malloc__,__malloc__(deallocator,ptrindex)))
+#      else
+#        define MAGICK_FUNC_MALLOC_1ARG(deallocator) MAGICK_ATTRIBUTE((__malloc__))
+#        define MAGICK_FUNC_MALLOC_2ARG(deallocator, ptrindex) MAGICK_ATTRIBUTE((__malloc__))
+#      endif
 #    endif
 #    if ((MAGICK_HAS_ATTRIBUTE(__nonnull__)) || \
-         (((__GNUC__) > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))))  /* 3.3+ */
+         (((__GNUC__) >= 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))))  /* 3.3+ */
   /* Supports argument syntax like MAGICK_ATTRIBUTE((nonnull (1, 2))) but
      don't know how to support non-GCC fallback. */
 #      define MAGICK_FUNC_NONNULL MAGICK_ATTRIBUTE((__nonnull__))
@@ -244,6 +252,12 @@
 #if !defined(MAGICK_FUNC_MALLOC)
 #  define MAGICK_FUNC_MALLOC /*nothing*/
 #endif
+#if !defined(MAGICK_FUNC_MALLOC_1ARG)
+#  define MAGICK_FUNC_MALLOC_1ARG(deallocator) /*nothing*/
+#endif
+#if !defined(MAGICK_FUNC_MALLOC_2ARG)
+#  define MAGICK_FUNC_MALLOC_2ARG(deallocator,ptrindex) /*nothing*/
+#endif
 #if !defined (MAGICK_FUNC_NONNULL)
 #  define MAGICK_FUNC_NONNULL /*nothing*/
 #endif
diff -r 49b1b6dcb93f -r 8a53ac7bbab5 magick/tempfile.h
--- a/magick/tempfile.h	Wed Sep 21 15:17:32 2022 -0500
+++ b/magick/tempfile.h	Sat Sep 24 17:52:07 2022 -0500
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2020 GraphicsMagick Group
+  Copyright (C) 2003-2022 GraphicsMagick Group
 
   This program is covered by multiple licenses, which are described in
   Copyright.txt. You should have received a copy of Copyright.txt with this
@@ -29,7 +29,7 @@
   AcquireTemporaryFileDescriptor(char *filename);
 
 MagickExport FILE *
-  AcquireTemporaryFileStream(char *filename,FileIOMode mode);
+  AcquireTemporaryFileStream(char *filename,FileIOMode mode) MAGICK_FUNC_MALLOC_2ARG(fclose, 1);
 
 #if defined(MAGICK_IMPLEMENTATION)
 #  include "magick/tempfile-private.h"
diff -r 49b1b6dcb93f -r 8a53ac7bbab5 magick/version.h
--- a/magick/version.h	Wed Sep 21 15:17:32 2022 -0500
+++ b/magick/version.h	Sat Sep 24 17:52:07 2022 -0500
@@ -38,8 +38,8 @@
 #define MagickLibVersion  0x272400
 #define MagickLibVersionText  "1.4"
 #define MagickLibVersionNumber 27,24,0
-#define MagickChangeDate   "20220918"
-#define MagickReleaseDate  "snapshot-20220918"
+#define MagickChangeDate   "20220924"
+#define MagickReleaseDate  "snapshot-20220924"
 
 /*
   The MagickLibInterfaceNewest and MagickLibInterfaceOldest defines
diff -r 49b1b6dcb93f -r 8a53ac7bbab5 www/Changelog.html
--- a/www/Changelog.html	Wed Sep 21 15:17:32 2022 -0500
+++ b/www/Changelog.html	Sat Sep 24 17:52:07 2022 -0500
@@ -35,6 +35,13 @@
 <div class="document">
 
 
+<p>2022-09-24  Bob Friesenhahn  &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
+<blockquote>
+<ul class="simple">
+<li>magick/common.h (MAGICK_FUNC_MALLOC_2ARG): Add macros to support
+GCC malloc attributes which accept arguments.</li>
+</ul>
+</blockquote>
 <p>2022-09-18  Bob Friesenhahn  &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
 <blockquote>
 <ul class="simple">
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.