Use Max/Min macros, not MAX/MIN, to eliminate portability issues.

This commit is contained in:
Tom Lane 2002-07-30 17:32:10 +00:00
parent 620abeb271
commit ea2d97414c
1 changed files with 7 additions and 11 deletions

View File

@ -2,15 +2,15 @@
#define YYERROR_VERBOSE #define YYERROR_VERBOSE
#define YYPARSE_PARAM result /* need this to pass a pointer (void *) to yyparse */ #define YYPARSE_PARAM result /* need this to pass a pointer (void *) to yyparse */
#include <string.h> #include "postgres.h"
#include <stdlib.h>
#include <math.h> #include <math.h>
#include "utils/elog.h"
#include "segdata.h" #include "segdata.h"
#include "buffer.h" #include "buffer.h"
#include "postgres.h"
#include "utils/elog.h"
#ifdef __CYGWIN__ #ifdef __CYGWIN__
#define HUGE HUGE_VAL #define HUGE HUGE_VAL
#endif /* __CYGWIN__ */ #endif /* __CYGWIN__ */
@ -27,10 +27,6 @@
float seg_atof( char *value ); 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; long threshold;
char strbuf[25] = { char strbuf[25] = {
'0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
@ -68,9 +64,9 @@ range:
((SEG *)result)->lower = $1.val - $3.val; ((SEG *)result)->lower = $1.val - $3.val;
((SEG *)result)->upper = $1.val + $3.val; ((SEG *)result)->upper = $1.val + $3.val;
sprintf(strbuf, "%g", ((SEG *)result)->lower); 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); 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)->l_ext = '\0';
((SEG *)result)->u_ext = '\0'; ((SEG *)result)->u_ext = '\0';
} }