Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ea2d974

Browse files
committed
Use Max/Min macros, not MAX/MIN, to eliminate portability issues.
1 parent 620abeb commit ea2d974

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

contrib/seg/segparse.y

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
#define YYERROR_VERBOSE
33
#define YYPARSE_PARAM result /* need this to pass a pointer (void *) to yyparse */
44

5-
#include <string.h>
6-
#include <stdlib.h>
5+
#include "postgres.h"
6+
77
#include <math.h>
8-
#include "segdata.h"
9-
#include "buffer.h"
108

11-
#include "postgres.h"
129
#include "utils/elog.h"
10+
11+
#include "segdata.h"
12+
#include "buffer.h"
1313

1414
#ifdef __CYGWIN__
1515
#define HUGE HUGE_VAL
@@ -27,10 +27,6 @@
2727

2828
float seg_atof( char *value );
2929

30-
#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
31-
#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
32-
#define ABS(X) ((X) < 0 ? (-X) : (X))
33-
3430
long threshold;
3531
char strbuf[25] = {
3632
'0', '0', '0', '0', '0',
@@ -68,9 +64,9 @@ range:
6864
((SEG *)result)->lower = $1.val - $3.val;
6965
((SEG *)result)->upper = $1.val + $3.val;
7066
sprintf(strbuf, "%g", ((SEG *)result)->lower);
71-
((SEG *)result)->l_sigd = MAX(MIN(6, significant_digits(strbuf)), MAX($1.sigd, $3.sigd));
67+
((SEG *)result)->l_sigd = Max(Min(6, significant_digits(strbuf)), Max($1.sigd, $3.sigd));
7268
sprintf(strbuf, "%g", ((SEG *)result)->upper);
73-
((SEG *)result)->u_sigd = MAX(MIN(6, significant_digits(strbuf)), MAX($1.sigd, $3.sigd));
69+
((SEG *)result)->u_sigd = Max(Min(6, significant_digits(strbuf)), Max($1.sigd, $3.sigd));
7470
((SEG *)result)->l_ext = '\0';
7571
((SEG *)result)->u_ext = '\0';
7672
}

0 commit comments

Comments
 (0)