diff --git a/src/gd.c b/src/gd.c index 3375eed..aea8015 100644 --- a/src/gd.c +++ b/src/gd.c @@ -499,12 +499,6 @@ BGD_DECLARE(int) gdImageColorClosestAlpha (gdImagePtr im, int r, int g, int b, i #define HWB_UNDEFINED -1 #define SETUP_RGB(s, r, g, b) {s.R = r/255.0; s.G = g/255.0; s.B = b/255.0;} -#define MIN(a,b) ((a)<(b)?(a):(b)) -#define MIN3(a,b,c) ((a)<(b)?(MIN(a,c)):(MIN(b,c))) -#define MAX(a,b) ((a)<(b)?(b):(a)) -#define MAX3(a,b,c) ((a)<(b)?(MAX(b,c)):(MAX(a,c))) - - /* * Theoretically, hue 0 (pure red) is identical to hue 6 in these transforms. Pure * red always maps to 6 in this implementation. Therefore UNDEFINED can be diff --git a/src/gd_filter.c b/src/gd_filter.c index 7855190..23bc564 100644 --- a/src/gd_filter.c +++ b/src/gd_filter.c @@ -30,8 +30,6 @@ typedef int (BGD_STDCALL *FuncPtr)(gdImagePtr, int, int); #define GET_PIXEL_FUNCTION(src)(src->trueColor?gdImageGetTrueColorPixel:gdImageGetPixel) -#define MIN(a,b) ((a)<(b)?(a):(b)) -#define MAX(a,b) ((a)<(b)?(b):(a)) #ifdef _WIN32 # define GD_SCATTER_SEED() (unsigned int)(time(0) * GetCurrentProcessId()) diff --git a/src/gd_intern.h b/src/gd_intern.h index 3bf1fa8..f8f3b5d 100644 --- a/src/gd_intern.h +++ b/src/gd_intern.h @@ -1,3 +1,5 @@ +/* Internal header for random common utility functions. */ + #ifndef GD_INTERN_H #define GD_INTERN_H @@ -29,15 +31,11 @@ #include "gd.h" -#ifndef MIN #define MIN(a,b) ((a)<(b)?(a):(b)) -#endif #define MIN3(a,b,c) ((a)<(b)?(MIN(a,c)):(MIN(b,c))) -#ifndef MAX #define MAX(a,b) ((a)<(b)?(b):(a)) -#endif #define MAX3(a,b,c) ((a)<(b)?(MAX(b,c)):(MAX(a,c))) - +#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) typedef enum { HORIZONTAL, diff --git a/src/gd_interpolation.c b/src/gd_interpolation.c index eeb9d19..ce27220 100644 --- a/src/gd_interpolation.c +++ b/src/gd_interpolation.c @@ -93,9 +93,6 @@ static gdImagePtr gdImageRotateNearestNeighbour(gdImagePtr src, static gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int bgColor); - -#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) - /* only used here, let do a generic fixed point integers later if required by other part of GD */ typedef long gdFixed; diff --git a/src/gd_tiff.c b/src/gd_tiff.c index 4020a6f..15e1056 100644 --- a/src/gd_tiff.c +++ b/src/gd_tiff.c @@ -71,10 +71,6 @@ #define GD_INDEXED 4 #define GD_RGB 5 -#define MIN(a,b) (a < b) ? a : b; -#define MAX(a,b) (a > b) ? a : b; - - typedef struct tiff_handle { int size; int pos; diff --git a/src/gdfx.c b/src/gdfx.c index 557f51c..dfc8fa7 100644 --- a/src/gdfx.c +++ b/src/gdfx.c @@ -4,6 +4,7 @@ #include "gd.h" #include "gd_errors.h" +#include "gd_intern.h" #include /* In tests this is sufficient to prevent obvious artifacts */ @@ -12,9 +13,6 @@ #define PI 3.141592 #define DEG2RAD(x) ((x)*PI/180.) -#define MAX(x,y) ((x) > (y) ? (x) : (y)) -#define MIN(x,y) ((x) < (y) ? (x) : (y)) - #define MAX4(x,y,z,w) \ ((MAX((x),(y))) > (MAX((z),(w))) ? (MAX((x),(y))) : (MAX((z),(w)))) #define MIN4(x,y,z,w) \ diff --git a/src/gdtestft.c b/src/gdtestft.c index f50b174..0663bf3 100644 --- a/src/gdtestft.c +++ b/src/gdtestft.c @@ -3,15 +3,13 @@ #endif #include "gd.h" +#include "gd_intern.h" #include #include #define PI 3.141592 #define DEG2RAD(x) ((x)*PI/180.) -#define MAX(x,y) ((x) > (y) ? (x) : (y)) -#define MIN(x,y) ((x) < (y) ? (x) : (y)) - #define MAX4(x,y,z,w) \ ((MAX((x),(y))) > (MAX((z),(w))) ? (MAX((x),(y))) : (MAX((z),(w)))) #define MIN4(x,y,z,w) \