1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Standardize on using the Min, Max, and Abs macros that are in our c.h file,

getting rid of numerous ad-hoc versions that have popped up in various
places.  Shortens code and avoids conflict with Windows min() and max()
macros.
This commit is contained in:
Tom Lane
2004-10-21 19:28:36 +00:00
parent a171fc1a4f
commit 380bd04c16
22 changed files with 34 additions and 77 deletions

View File

@ -37,7 +37,7 @@
*
*
* 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
*
@ -3702,7 +3702,7 @@ win32_waitpid(int *exitstatus)
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)

View File

@ -8,7 +8,7 @@
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
@ -111,14 +111,9 @@ static PGresult *PQexecFinish(PGconn *conn);
* ----------------
*/
#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)

View File

@ -1,5 +1,5 @@
/*
* $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"
@ -272,8 +272,6 @@ pt_in_widget(PG_FUNCTION_ARGS)
PG_RETURN_BOOL(point_dt(point, &widget->center) < widget->radius);
}
#define ABS(X) ((X) >= 0 ? (X) : -(X))
PG_FUNCTION_INFO_V1(boxarea);
Datum
@ -283,8 +281,8 @@ boxarea(PG_FUNCTION_ARGS)
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);
}