OSDN Git Service

Fix a couple of places where lack of parenthesization of a cast
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 25 Oct 2001 20:37:30 +0000 (20:37 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 25 Oct 2001 20:37:30 +0000 (20:37 +0000)
causes pgindent to make weird formatting decisions.  Easiest fix
seems to be to put in the extra parens...

src/backend/access/transam/clog.c
src/backend/catalog/index.c
src/backend/commands/analyze.c

index 1436b32..c0149f0 100644 (file)
@@ -13,7 +13,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Header: /cvsroot/pgsql/src/backend/access/transam/clog.c,v 1.5 2001/10/25 05:49:22 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/clog.c,v 1.6 2001/10/25 20:37:29 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -936,11 +936,9 @@ CLOGPagePrecedes(int page1, int page2)
        TransactionId xid1;
        TransactionId xid2;
 
-       xid1 = (TransactionId) page1 *CLOG_XACTS_PER_PAGE;
-
+       xid1 = ((TransactionId) page1) * CLOG_XACTS_PER_PAGE;
        xid1 += FirstNormalTransactionId;
-       xid2 = (TransactionId) page2 *CLOG_XACTS_PER_PAGE;
-
+       xid2 = ((TransactionId) page2) * CLOG_XACTS_PER_PAGE;
        xid2 += FirstNormalTransactionId;
 
        return TransactionIdPrecedes(xid1, xid2);
index 0afb9cf..4e338b0 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.166 2001/10/25 05:49:22 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.167 2001/10/25 20:37:30 tgl Exp $
  *
  *
  * INTERFACE ROUTINES
@@ -1492,7 +1492,7 @@ UpdateStats(Oid relid, double reltuples)
                        reltuples = 1000;
                }
                else
-                       reltuples = (double) relpages *NTUPLES_PER_PAGE(whichRel->rd_rel->relnatts);
+                       reltuples = ((double) relpages) * NTUPLES_PER_PAGE(whichRel->rd_rel->relnatts);
        }
 
        /*
index 41c863a..085032c 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.23 2001/10/25 05:49:23 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.24 2001/10/25 20:37:30 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1244,8 +1244,7 @@ compute_scalar_stats(VacAttrStats *stats,
                {
                        int                     tupno = values[i].tupno;
 
-                       corr_xysum += (double) i *(double) tupno;
-
+                       corr_xysum += ((double) i) * ((double) tupno);
                        dups_cnt++;
                        if (tupnoLink[tupno] == tupno)
                        {
@@ -1519,9 +1518,10 @@ compute_scalar_stats(VacAttrStats *stats,
                         *              (values_cnt-1)*values_cnt*(2*values_cnt-1) / 6.
                         *----------
                         */
-                       corr_xsum = (double) (values_cnt - 1) * (double) values_cnt / 2.0;
-                       corr_x2sum = (double) (values_cnt - 1) * (double) values_cnt *
-                                               (double) (2 * values_cnt - 1) / 6.0;
+                       corr_xsum = ((double) (values_cnt - 1)) *
+                               ((double) values_cnt) / 2.0;
+                       corr_x2sum = ((double) (values_cnt - 1)) *
+                               ((double) values_cnt) * (double) (2 * values_cnt - 1) / 6.0;
 
                        /* And the correlation coefficient reduces to */
                        corrs[0] = (values_cnt * corr_xysum - corr_xsum * corr_xsum) /