From 512336676ec63d7737889c03619e3af014a4540d Mon Sep 17 00:00:00 2001 From: John Bowler Date: Mon, 26 Dec 2016 16:46:30 -0800 Subject: [PATCH] Remove 'defined' within macro This eliminates the use of 'defined' within macros that get substituted on #if lines; see the previous patch for a more detailed discussion. Signed-off-by: John Bowler --- png.c | 9 +++++++-- pngpriv.h | 10 +++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/png.c b/png.c index de8bd8be6..23ddc2915 100644 --- a/png.c +++ b/png.c @@ -996,8 +996,13 @@ png_colorspace_set_gamma(png_const_structrp png_ptr, * In 1.6.0 this test replaces the ones in pngrutil.c, in the gAMA chunk * handling code, which only required the value to be >0. */ -# define ERRMSG (defined PNG_TRANSFORM_MECH_SUPPORTED) &&\ - (defined PNG_ERROR_TEXT_SUPPORTED) +# if (defined PNG_TRANSFORM_MECH_SUPPORTED) &&\ + (defined PNG_ERROR_TEXT_SUPPORTED) +# define ERRMSG 1 +# else +# define ERRMSG 0 +# endif + # if ERRMSG png_const_charp errmsg; # endif diff --git a/pngpriv.h b/pngpriv.h index b6ceb95d0..c0f29512c 100644 --- a/pngpriv.h +++ b/pngpriv.h @@ -319,9 +319,13 @@ * is just the affirm code; there's no reason to allow configuration of this * option. */ -#define PNG_AFFIRM_TEXT (PNG_RELEASE_BUILD ?\ - (defined PNG_ERROR_TEXT_SUPPORTED) :\ - (defined PNG_WARNINGS_SUPPORTED) || (defined PNG_CONSOLE_IO_SUPPORTED)) +#if PNG_RELEASE_BUILD ?\ + (defined PNG_ERROR_TEXT_SUPPORTED) :\ + (defined PNG_WARNINGS_SUPPORTED) || (defined PNG_CONSOLE_IO_SUPPORTED) +# define PNG_AFFIRM_TEXT 1 +#else +# define PNG_AFFIRM_TEXT 0 +#endif /* PNG_AFFIRM_TEXT definition */ #define PNG_SRC_LINE (PNG_SRC_FILE + __LINE__)