From c5808c56db166528ae7e74cedb51cc466f973b9f Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Wed, 9 Sep 2020 16:56:04 +1000 Subject: Consolidate repeated macro definitions into one header The MIN, MAX, CLAMP, MINIMUM, and MAXIMUM macros appear throughout the codebase with many re-definitions. Make a single copy of each in a common header file, and use the BSD variants of MINIMUM/MAXIMUM due to conflicts in the system headers. --- Header.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'Header.c') diff --git a/Header.c b/Header.c index ffd31a24..574165a6 100644 --- a/Header.c +++ b/Header.c @@ -16,14 +16,7 @@ in the source distribution for its full text. #include #include - -#ifndef MAX -#define MAX(a,b) ((a)>(b)?(a):(b)) -#endif - -#ifndef Header_forEachColumn #define Header_forEachColumn(this_, i_) for (int (i_)=0; (i_) < (this_)->nrColumns; ++(i_)) -#endif Header* Header_new(struct ProcessList_* pl, Settings* settings, int nrColumns) { Header* this = xCalloc(1, sizeof(Header)); @@ -196,7 +189,7 @@ int Header_calculateHeight(Header* this) { Meter* meter = (Meter*) Vector_get(meters, i); height += meter->h; } - maxHeight = MAX(maxHeight, height); + maxHeight = MAXIMUM(maxHeight, height); } this->height = maxHeight; this->pad = pad; -- cgit v1.2.3