#include "cubedata.h"
-#define abs(a) ((a) < (0) ? (-a) : (a))
-
extern int cube_yyparse();
extern void cube_yyerror(const char *message);
extern void cube_scanner_init(const char *str);
*result = 1.0;
for (i = 0, j = a->dim; i < a->dim; i++, j++)
- *result = (*result) * abs((a->x[j] - a->x[i]));
+ *result = (*result) * Abs((a->x[j] - a->x[i]));
return (result);
}
{
*size = 1.0;
for (i = 0, j = a->dim; i < a->dim; i++, j++)
- *size = (*size) * abs((a->x[j] - a->x[i]));
+ *size = (*size) * Abs((a->x[j] - a->x[i]));
}
return;
}
/* number ranges for compression */
#define MAXNUMRANGE 100
-#define max(a,b) ((a) > (b) ? (a) : (b))
-#define min(a,b) ((a) <= (b) ? (a) : (b))
-#define abs(a) ((a) < (0) ? -(a) : (a))
-
/* dimension of array */
#define NDIM 1
union_d = inner_int_union(datum_r, datum_alpha);
rt__int_size(union_d, &size_beta);
pfree(union_d);
- costvector[i - 1].cost = abs((size_alpha - size_l) - (size_beta - size_r));
+ costvector[i - 1].cost = Abs((size_alpha - size_l) - (size_beta - size_r));
}
qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
nb = ARRNELEMS(b);
da = ARRPTR(a);
db = ARRPTR(b);
- r = new_intArrayType(min(na, nb));
+ r = new_intArrayType(Min(na, nb));
dr = ARRPTR(r);
i = j = 0;
_j = GETENTRY(entryvec, j);
size_alpha = hemdist(datum_l, _j);
size_beta = hemdist(datum_r, _j);
- costvector[j - 1].cost = abs(size_alpha - size_beta);
+ costvector[j - 1].cost = Abs(size_alpha - size_beta);
}
qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
_j = GETENTRY(entryvec, j);
size_alpha = hemdist(datum_l, _j);
size_beta = hemdist(datum_r, _j);
- costvector[j - 1].cost = abs(size_alpha - size_beta);
+ costvector[j - 1].cost = Abs(size_alpha - size_beta);
}
qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
#define LQUERY_HASNOT 0x01
-#ifndef max
-#define max(a,b) ((a) > (b) ? (a) : (b))
-#endif
-#ifndef min
-#define min(a,b) ((a) <= (b) ? (a) : (b))
-#endif
-#ifndef abs
-#define abs(a) ((a) < (0) ? -(a) : (a))
-#endif
#define ISALNUM(x) ( isalnum((unsigned char)(x)) || (x) == '_' )
/* full text query */
cmpl = ltree_compare(LTG_GETLNODE(origval), LTG_GETLNODE(newval));
cmpr = ltree_compare(LTG_GETRNODE(newval), LTG_GETRNODE(origval));
- *penalty = max(cmpl, 0) + max(cmpr, 0);
+ *penalty = Max(cmpl, 0) + Max(cmpr, 0);
PG_RETURN_POINTER(penalty);
}
while (an > 0 && bn > 0)
{
bl = LQL_FIRST(ql);
- if ((res = strncmp(al->name, bl->name, min(al->len, bl->len))) == 0)
+ if ((res = strncmp(al->name, bl->name, Min(al->len, bl->len))) == 0)
{
if (al->len != bl->len)
return al->len - bl->len;
while (an > 0 && bn > 0)
{
- if ((res = strncmp(al->name, bl->name, min(al->len, bl->len))) == 0)
+ if ((res = strncmp(al->name, bl->name, Min(al->len, bl->len))) == 0)
{
if (al->len != bl->len)
return (al->len - bl->len) * 10 * (an + 1);
l2 = LTREE_FIRST(*ptr);
tmp = num;
num = 0;
- for (i = 0; i < min(tmp, (*ptr)->numlevel - 1); i++)
+ for (i = 0; i < Min(tmp, (*ptr)->numlevel - 1); i++)
{
if (l1->len == l2->len && strncmp(l1->name, l2->name, l1->len) == 0)
num = i + 1;
#include "misc_utils.h"
-#undef MIN
-#define MIN(x,y) ((x)<=(y) ? (x) : (y))
-
int
backend_pid()
}
int
-max(int x, int y)
+int4max(int x, int y)
{
- return ((x > y) ? x : y);
+ return Max(x, y);
}
int
-min(int x, int y)
+int4min(int x, int y)
{
- return ((x < y) ? x : y);
+ return Min(x, y);
}
/*
if (relname && (VARSIZE(relname) > VARHDRSZ))
{
MemSet(listen_name, 0, NAMEDATALEN);
- len = MIN(VARSIZE(relname) - VARHDRSZ, NAMEDATALEN - 1);
+ len = Min(VARSIZE(relname) - VARHDRSZ, NAMEDATALEN - 1);
memcpy(listen_name, VARDATA(relname), len);
ScanKeyInit(&key,
Anum_pg_listener_relname,
#ifndef MISC_UTILS_H
#define MISC_UTILS_H
-#ifdef max
-#undef max
-#endif
-#ifdef min
-#undef min
-#endif
-
int backend_pid(void);
int unlisten(char *relname);
-int max(int x, int y);
-int min(int x, int y);
+int int4max(int x, int y);
+int int4min(int x, int y);
int active_listeners(text *relname);
#endif
--
CREATE OR REPLACE FUNCTION min(int4,int4)
RETURNS int4
-AS 'MODULE_PATHNAME'
+AS 'MODULE_PATHNAME', 'int4min'
LANGUAGE 'C';
-- max(x,y)
--
CREATE OR REPLACE FUNCTION max(int4,int4)
RETURNS int4
-AS 'MODULE_PATHNAME'
+AS 'MODULE_PATHNAME', 'int4max'
LANGUAGE 'C';
-- Return the number of active listeners on a relation
#include "segdata.h"
-#define abs(a) ((a) < (0) ? (-a) : (a))
-
/*
#define GIST_DEBUG
#define GIST_QUERY_DEBUG
if (a == (SEG *) NULL || a->upper <= a->lower)
*size = 0.0;
else
- *size = (float) abs(a->upper - a->lower);
+ *size = (float) Abs(a->upper - a->lower);
return;
}
result = (float *) palloc(sizeof(float));
- *result = (float) abs(a->upper - a->lower);
+ *result = (float) Abs(a->upper - a->lower);
return (result);
}
}
else
{
- if (abs(exp) <= 4)
+ if (Abs(exp) <= 4)
{
/*
* remove the decimal point from the mantyssa and write the
}
}
- /* do nothing for abs(exp) > 4; %e must be OK */
+ /* do nothing for Abs(exp) > 4; %e must be OK */
/* just get rid of zeroes after [eE]- and +zeroes after [Ee]. */
/* ... this is not done yet. */
/* define this if you want to see iso-8859 characters */
#define ISO8859
-#undef MIN
-#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define VALUE(char) ((char) - '0')
#define DIGIT(val) ((val) + '0')
#define ISOCTAL(c) (((c) >= '0') && ((c) <= '7'))
else
/* result has variable length with maximum size */
if (size < 0)
- size = MIN(len, -size) + 1;
+ size = Min(len, -size) + 1;
result = (char *) palloc(hdrsize + size);
memset(result, 0, hdrsize + size);
}
}
- costvector[j - 1].cost = abs(size_alpha - size_beta);
+ costvector[j - 1].cost = Abs(size_alpha - size_beta);
}
qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
#define SETBIT(x,i) GETBYTE(x,i) |= ( 0x01 << ( (i) % BITBYTE ) )
#define GETBIT(x,i) ( (GETBYTE(x,i) >> ( (i) % BITBYTE )) & 0x01 )
-#define abs(a) ((a) < (0) ? -(a) : (a))
-#ifdef min
-#undef min
-#endif
-#define min(a,b) ((a) < (b) ? (a) : (b))
#define HASHVAL(val) (((unsigned int)(val)) % SIGLENBIT)
#define HASH(sign, val) SETBIT((sign), HASHVAL(val))
costvector[j - 1].pos = j;
size_alpha = hemdistcache(&(cache[seed_1]), &(cache[j]));
size_beta = hemdistcache(&(cache[seed_2]), &(cache[j]));
- costvector[j - 1].cost = abs(size_alpha - size_beta);
+ costvector[j - 1].cost = Abs(size_alpha - size_beta);
}
qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
#define SETBIT(x,i) GETBYTE(x,i) |= ( 0x01 << ( (i) % BITBYTE ) )
#define GETBIT(x,i) ( (GETBYTE(x,i) >> ( (i) % BITBYTE )) & 0x01 )
-#define abs(a) ((a) < (0) ? -(a) : (a))
-#define min(a,b) ((a) < (b) ? (a) : (b))
#define HASHVAL(val) (((unsigned int)(val)) % SIGLENBIT)
#define HASH(sign, val) SETBIT((sign), HASHVAL(val))
{
for (p = 0; p < lenct; p++)
{
- dist = abs(post[l].pos - ct[p].pos);
+ dist = Abs(post[l].pos - ct[p].pos);
if (dist || (dist == 0 && (pos[i] == (uint16 *) POSNULL || pos[k] == (uint16 *) POSNULL)))
{
float curw;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.434 2004/10/15 04:54:31 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.435 2004/10/21 19:28:35 tgl Exp $
*
* NOTES
*
for (offset = 0; offset < win32_numChildren; offset += MAXIMUM_WAIT_OBJECTS)
{
- unsigned long num = min(MAXIMUM_WAIT_OBJECTS, win32_numChildren - offset);
+ unsigned long num = Min(MAXIMUM_WAIT_OBJECTS, win32_numChildren - offset);
ret = WaitForMultipleObjects(num, &win32_childHNDArray[offset], FALSE, 0);
switch (ret)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.164 2004/10/18 22:00:42 tgl Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.165 2004/10/21 19:28:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* ----------------
*/
-#ifdef MAX
-#undef MAX
-#endif
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-
#define PGRESULT_DATA_BLOCKSIZE 2048
#define PGRESULT_ALIGN_BOUNDARY MAXIMUM_ALIGNOF /* from configure */
-#define PGRESULT_BLOCK_OVERHEAD MAX(sizeof(PGresult_data), PGRESULT_ALIGN_BOUNDARY)
+#define PGRESULT_BLOCK_OVERHEAD Max(sizeof(PGresult_data), PGRESULT_ALIGN_BOUNDARY)
#define PGRESULT_SEP_ALLOC_THRESHOLD (PGRESULT_DATA_BLOCKSIZE / 2)
/*
- * $PostgreSQL: pgsql/src/test/regress/regress.c,v 1.61 2004/10/07 15:21:58 momjian Exp $
+ * $PostgreSQL: pgsql/src/test/regress/regress.c,v 1.62 2004/10/21 19:28:36 tgl Exp $
*/
#include "postgres.h"
PG_RETURN_BOOL(point_dt(point, &widget->center) < widget->radius);
}
-#define ABS(X) ((X) >= 0 ? (X) : -(X))
-
PG_FUNCTION_INFO_V1(boxarea);
Datum
double width,
height;
- width = ABS(box->high.x - box->low.x);
- height = ABS(box->high.y - box->low.y);
+ width = Abs(box->high.x - box->low.x);
+ height = Abs(box->high.y - box->low.y);
PG_RETURN_FLOAT8(width * height);
}