diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2018-08-23 22:57:27 +0200 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2018-08-23 23:15:39 +0200 |
commit | 3bd41aaf7f882cb1df4ab62a064920b797c5b41d (patch) | |
tree | 995443565bb0c12bb06ff2bde8982ae8e4caa145 | |
parent | b517b66efcbb30bb7f7add4fb5bfe48f3185b615 (diff) | |
download | nx-libs-3bd41aaf7f882cb1df4ab62a064920b797c5b41d.tar.gz nx-libs-3bd41aaf7f882cb1df4ab62a064920b797c5b41d.tar.bz2 nx-libs-3bd41aaf7f882cb1df4ab62a064920b797c5b41d.zip |
Replace MIN/MAX macros by min/max from misc.h
We do not need two versions in the code
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Drawable.c | 5 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Font.c | 2 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Keystroke.c | 2 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Screen.c | 17 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Utils.h | 8 |
5 files changed, 14 insertions, 20 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c index 522870546..88f3da3a9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c @@ -25,6 +25,7 @@ #include "dixstruct.h" #include "../../fb/fb.h" +#include "misc.h" #include "Agent.h" #include "Display.h" @@ -696,11 +697,11 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned for (y = box.y1; y < box.y2; y += h) { - h = MIN(box.y2 - y, tileHeight); + h = min(box.y2 - y, tileHeight); for (x = box.x1; x < box.x2; x += w) { - w = MIN(box.x2 - x, tileWidth); + w = min(box.x2 - x, tileWidth); /* * FIXME: This should not occur. diff --git a/nx-X11/programs/Xserver/hw/nxagent/Font.c b/nx-X11/programs/Xserver/hw/nxagent/Font.c index a1690ebb8..57909d7fc 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Font.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Font.c @@ -1415,7 +1415,7 @@ static Bool nxagentGetFontServerPath(char * fontServerPath, int size) if (len) { - snprintf(fontServerPath, MIN(size, len + 1), "%s", path + 1); + snprintf(fontServerPath, min(size, len + 1), "%s", path + 1); #ifdef TEST fprintf(stderr, "nxagentGetFontServerPath: Got path [%s].\n", diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c index 61b4512fb..6def29ae4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c @@ -431,7 +431,7 @@ void nxagentDumpKeystrokes(void) { int maxlen = 0; for (int i = 0; nxagentSpecialKeystrokeNames[i]; i++) - maxlen = MAX(maxlen, strlen(nxagentSpecialKeystrokeNames[i])); + maxlen = min(maxlen, strlen(nxagentSpecialKeystrokeNames[i])); fprintf(stderr, "Current known keystrokes:\n"); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 036e5b4b8..b5aabf8bd 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -55,6 +55,7 @@ is" without express or implied warranty. #include "../../randr/randrstr.h" #include "inputstr.h" #include "mivalidate.h" +#include "misc.h" #include "Agent.h" #include "Display.h" @@ -3641,10 +3642,10 @@ Bool intersect(int ax1, int ay1, unsigned int aw, unsigned int ah, return FALSE; } - tx1 = MAX(ax1, bx1); - ty1 = MAX(ay1, by1); - tx2 = MIN(ax2, bx2); - ty2 = MIN(ay2, by2); + tx1 = max(ax1, bx1); + ty1 = max(ay1, by1); + tx2 = min(ax2, bx2); + ty2 = min(ay2, by2); ix = tx1 - ax1; iy = ty1 - ay1; @@ -4022,10 +4023,10 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) bbx1 = bby1 = INT_MAX; for (i = 0; i < number; i++) { - bbx2 = MAX(bbx2, screeninfo[i].x_org + screeninfo[i].width); - bby2 = MAX(bby2, screeninfo[i].y_org + screeninfo[i].height); - bbx1 = MIN(bbx1, screeninfo[i].x_org); - bby1 = MIN(bby1, screeninfo[i].y_org); + bbx2 = max(bbx2, screeninfo[i].x_org + screeninfo[i].width); + bby2 = max(bby2, screeninfo[i].y_org + screeninfo[i].height); + bbx1 = min(bbx1, screeninfo[i].x_org); + bby1 = min(bby1, screeninfo[i].y_org); } #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: bounding box: left [%d] right [%d] top [%d] bottom [%d]\n", bbx1, bbx2, bby1, bby2); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Utils.h b/nx-X11/programs/Xserver/hw/nxagent/Utils.h index 8a3335424..63904e23b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Utils.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Utils.h @@ -40,14 +40,6 @@ #define nxagentScale(i, ratio) (((i) * (ratio)) >> (PRECISION)) -#ifndef MIN -#define MIN(A, B) ( (A) < (B) ? (A) : (B) ) -#endif - -#ifndef MAX -#define MAX(A, B) ( (A) > (B) ? (A) : (B) ); -#endif - static inline const char * validateString(const char *str) { return str ? str : "(null)"; } |