aboutsummaryrefslogtreecommitdiff
path: root/contrib/rtree_gist/rtree_gist.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2005-05-25 21:40:43 +0000
committerBruce Momjian <bruce@momjian.us>2005-05-25 21:40:43 +0000
commitb492c3acccb3f8c97559ddfc2a25f25953a026d2 (patch)
treea9c42aa2bd86a88a849ffaa005766ffe3dee762a /contrib/rtree_gist/rtree_gist.c
parent13b729ca5267b58005f1ca9c873a86c2b0db3591 (diff)
downloadpostgresql-b492c3acccb3f8c97559ddfc2a25f25953a026d2.tar.gz
postgresql-b492c3acccb3f8c97559ddfc2a25f25953a026d2.zip
Add parentheses to macros when args are used in computations. Without
them, the executation behavior could be unexpected.
Diffstat (limited to 'contrib/rtree_gist/rtree_gist.c')
-rw-r--r--contrib/rtree_gist/rtree_gist.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/contrib/rtree_gist/rtree_gist.c b/contrib/rtree_gist/rtree_gist.c
index d2f41569200..55a480915fb 100644
--- a/contrib/rtree_gist/rtree_gist.c
+++ b/contrib/rtree_gist/rtree_gist.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/contrib/rtree_gist/rtree_gist.c,v 1.11 2005/05/21 12:08:05 neilc Exp $
+ * $PostgreSQL: pgsql/contrib/rtree_gist/rtree_gist.c,v 1.12 2005/05/25 21:40:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -276,14 +276,14 @@ gbox_picksplit(PG_FUNCTION_ARGS)
#define ADDLIST( list, unionD, pos, num ) do { \
if ( pos ) { \
- if ( unionD->high.x < cur->high.x ) unionD->high.x = cur->high.x; \
- if ( unionD->low.x > cur->low.x ) unionD->low.x = cur->low.x; \
- if ( unionD->high.y < cur->high.y ) unionD->high.y = cur->high.y; \
- if ( unionD->low.y > cur->low.y ) unionD->low.y = cur->low.y; \
+ if ( (unionD)->high.x < cur->high.x ) (unionD)->high.x = cur->high.x; \
+ if ( (unionD)->low.x > cur->low.x ) (unionD)->low.x = cur->low.x; \
+ if ( (unionD)->high.y < cur->high.y ) (unionD)->high.y = cur->high.y; \
+ if ( (unionD)->low.y > cur->low.y ) (unionD)->low.y = cur->low.y; \
} else { \
- memcpy( (void*)unionD, (void*) cur, sizeof( BOX ) ); \
+ memcpy( (void*)(unionD), (void*) cur, sizeof( BOX ) ); \
} \
- list[pos] = num; \
+ (list)[pos] = num; \
(pos)++; \
} while(0)