shithub: dumb

Download patch

ref: 6e924e69701ffca777aa88bb9648af9541f53c56
parent: 9ab5cfbbfdd10603b8f3068ed994982e989839ec
author: Christopher Snowhill <kode54@gmail.com>
date: Mon Sep 18 14:09:08 EDT 2017

Move MIN/MAX/MID/ABS macros to internal/dumb.h, so they won't be seen by software using the library. Add internal/dumb.h to two files which use the macros, which did not already import them.

--- a/include/dumb.h
+++ b/include/dumb.h
@@ -77,18 +77,6 @@
 #define DUMB_DATE_STR DUMB_DAY_STR1 "." DUMB_MONTH_STR1 "." DUMB_YEAR_STR4
 
 
-#undef MIN
-#undef MAX
-#undef MID
-
-#define MIN(x,y)   (((x) < (y)) ? (x) : (y))
-#define MAX(x,y)   (((x) > (y)) ? (x) : (y))
-#define MID(x,y,z) MAX((x), MIN((y), (z)))
-
-#undef ABS
-#define ABS(x) (((x) >= 0) ? (x) : (-(x)))
-
-
 #ifdef DEBUGMODE
 
 #ifndef ASSERT
--- a/include/internal/dumb.h
+++ b/include/internal/dumb.h
@@ -27,6 +27,17 @@
 #define INTERNAL_DUMB_H
 
 
+#undef MIN
+#undef MAX
+#undef MID
+
+#define MIN(x,y)   (((x) < (y)) ? (x) : (y))
+#define MAX(x,y)   (((x) > (y)) ? (x) : (y))
+#define MID(x,y,z) MAX((x), MIN((y), (z)))
+
+#undef ABS
+#define ABS(x) (((x) >= 0) ? (x) : (-(x)))
+
 typedef struct DUH_SIGTYPE_DESC_LINK
 {
 	struct DUH_SIGTYPE_DESC_LINK *next;
--- a/src/core/dumbfile.c
+++ b/src/core/dumbfile.c
@@ -20,6 +20,7 @@
 #include <stdlib.h>
 
 #include "dumb.h"
+#include "internal/dumb.h"
 
 
 
--- a/src/it/readmod.c
+++ b/src/it/readmod.c
@@ -22,6 +22,7 @@
 #include <math.h>
 
 #include "dumb.h"
+#include "internal/dumb.h"
 #include "internal/it.h"