aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-07-30 17:32:10 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-07-30 17:32:10 +0000
commitea2d97414c58bd28af5516047d76239e6ec7bef6 (patch)
tree5385f304760dd00ad4c94c82c9582667adc3790d
parent620abeb2718d24a4da45afcc2fa1a4810881478a (diff)
downloadpostgresql-ea2d97414c58bd28af5516047d76239e6ec7bef6.tar.gz
postgresql-ea2d97414c58bd28af5516047d76239e6ec7bef6.zip
Use Max/Min macros, not MAX/MIN, to eliminate portability issues.
-rw-r--r--contrib/seg/segparse.y18
1 files changed, 7 insertions, 11 deletions
diff --git a/contrib/seg/segparse.y b/contrib/seg/segparse.y
index 3c2d6c28c0b..10a4227c190 100644
--- a/contrib/seg/segparse.y
+++ b/contrib/seg/segparse.y
@@ -2,14 +2,14 @@
#define YYERROR_VERBOSE
#define YYPARSE_PARAM result /* need this to pass a pointer (void *) to yyparse */
-#include <string.h>
-#include <stdlib.h>
+#include "postgres.h"
+
#include <math.h>
-#include "segdata.h"
-#include "buffer.h"
-#include "postgres.h"
#include "utils/elog.h"
+
+#include "segdata.h"
+#include "buffer.h"
#ifdef __CYGWIN__
#define HUGE HUGE_VAL
@@ -27,10 +27,6 @@
float seg_atof( char *value );
-#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
-#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
-#define ABS(X) ((X) < 0 ? (-X) : (X))
-
long threshold;
char strbuf[25] = {
'0', '0', '0', '0', '0',
@@ -68,9 +64,9 @@ range:
((SEG *)result)->lower = $1.val - $3.val;
((SEG *)result)->upper = $1.val + $3.val;
sprintf(strbuf, "%g", ((SEG *)result)->lower);
- ((SEG *)result)->l_sigd = MAX(MIN(6, significant_digits(strbuf)), MAX($1.sigd, $3.sigd));
+ ((SEG *)result)->l_sigd = Max(Min(6, significant_digits(strbuf)), Max($1.sigd, $3.sigd));
sprintf(strbuf, "%g", ((SEG *)result)->upper);
- ((SEG *)result)->u_sigd = MAX(MIN(6, significant_digits(strbuf)), MAX($1.sigd, $3.sigd));
+ ((SEG *)result)->u_sigd = Max(Min(6, significant_digits(strbuf)), Max($1.sigd, $3.sigd));
((SEG *)result)->l_ext = '\0';
((SEG *)result)->u_ext = '\0';
}