From 88e948216c4b9085a795d3c882ba6f68b78efa6a Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Mon, 11 Jun 2001 05:00:56 +0000
Subject: [PATCH] Nest macros with slightly less enthusiasm, for performance
 and to avoid having non-gcc compilers spit up.

---
 src/backend/access/gist/gist.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c
index 8f0cfbbb499..9d6e2040f6c 100644
--- a/src/backend/access/gist/gist.c
+++ b/src/backend/access/gist/gist.c
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.78 2001/05/31 18:16:54 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.79 2001/06/11 05:00:56 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1370,8 +1370,10 @@ gistchoose(Relation r, Page p, IndexTuple it,	/* it has compressed entry */
 	for (i = FirstOffsetNumber; i <= maxoff && sum_grow; i = OffsetNumberNext(i))
 	{
 		sum_grow=0;
-		for( j=0; j<r->rd_att->natts; j++ ) {
-			datum = index_getattr( (IndexTuple)PageGetItem(p, PageGetItemId(p, i)), j+1, r->rd_att, &IsNull);
+		for (j=0; j<r->rd_att->natts; j++) {
+			IndexTuple itup = (IndexTuple) PageGetItem(p, PageGetItemId(p, i));
+
+			datum = index_getattr(itup, j+1, r->rd_att, &IsNull);
 			gistdentryinit(giststate, j, &entry, datum, r, p, i, ATTSIZE( datum, r, j+1, IsNull ), FALSE);
 			FunctionCall3(&giststate->penaltyFn[j],
 						  PointerGetDatum(&entry),
-- 
GitLab