]> granicus.if.org Git - postgresql/commitdiff
Cleanup various comparisons with the constant "true".
authorRobert Haas <rhaas@postgresql.org>
Mon, 15 Nov 2010 02:03:48 +0000 (21:03 -0500)
committerRobert Haas <rhaas@postgresql.org>
Mon, 15 Nov 2010 02:03:48 +0000 (21:03 -0500)
Itagaki Takahiro, with slight modifications.

contrib/pg_upgrade/pg_upgrade.c
src/backend/access/gin/ginget.c
src/backend/access/gist/gistproc.c
src/backend/commands/sequence.c
src/backend/tsearch/regis.c
src/backend/utils/adt/geo_ops.c
src/backend/utils/adt/tsrank.c
src/backend/utils/adt/tsvector_op.c
src/bin/psql/print.c
src/interfaces/ecpg/ecpglib/connect.c
src/interfaces/ecpg/preproc/ecpg.addons

index 25d732b247d8b846cb1908dbedab543916b846a8..3f09f793d24e8da33ada6ba676475862b1afd457 100644 (file)
@@ -254,7 +254,7 @@ copy_clog_xlog_xid(void)
 
        snprintf(old_clog_path, sizeof(old_clog_path), "%s/pg_clog", old_cluster.pgdata);
        snprintf(new_clog_path, sizeof(new_clog_path), "%s/pg_clog", new_cluster.pgdata);
-       if (rmtree(new_clog_path, true) != true)
+       if (!rmtree(new_clog_path, true))
                pg_log(PG_FATAL, "Unable to delete directory %s\n", new_clog_path);
        check_ok();
 
index 064ac94129d7f470ec535046f8d1ba26afb0046b..34a6cd9cfdcfa9ef2a98e5424df72295d7071771 100644 (file)
@@ -1361,7 +1361,7 @@ scanGetItem(IndexScanDesc scan, ItemPointer advancePast,
 }
 
 #define GinIsNewKey(s)         ( ((GinScanOpaque) scan->opaque)->keys == NULL )
-#define GinIsVoidRes(s)                ( ((GinScanOpaque) scan->opaque)->isVoidRes == true )
+#define GinIsVoidRes(s)                ( ((GinScanOpaque) scan->opaque)->isVoidRes )
 
 Datum
 gingetbitmap(PG_FUNCTION_ARGS)
index 9f6fb34280a788edbe2d4e24f205ddefa3c8a044..681ffd27d4f02e6384ac09936a81f7e603ca8133 100644 (file)
@@ -380,12 +380,12 @@ gist_box_picksplit(PG_FUNCTION_ARGS)
        for (i = OffsetNumberNext(FirstOffsetNumber); i <= maxoff; i = OffsetNumberNext(i))
        {
                cur = DatumGetBoxP(entryvec->vector[i].key);
-               if (allisequal == true && (
-                                                                  pageunion.high.x != cur->high.x ||
-                                                                  pageunion.high.y != cur->high.y ||
-                                                                  pageunion.low.x != cur->low.x ||
-                                                                  pageunion.low.y != cur->low.y
-                                                                  ))
+               if (allisequal && (
+                                                  pageunion.high.x != cur->high.x ||
+                                                  pageunion.high.y != cur->high.y ||
+                                                  pageunion.low.x != cur->low.x ||
+                                                  pageunion.low.y != cur->low.y
+                                                  ))
                        allisequal = false;
 
                adjustBox(&pageunion, cur);
index 04b0c71c539ae08599eec5e49fb986e1f4d78f1d..62d1fbfb0eba4e23e45cba972d46724a8e16fbec 100644 (file)
@@ -1104,7 +1104,7 @@ init_params(List *options, bool isInit,
        if (is_cycled != NULL)
        {
                new->is_cycled = intVal(is_cycled->arg);
-               Assert(new->is_cycled == false || new->is_cycled == true);
+               Assert(BoolIsValid(new->is_cycled));
        }
        else if (isInit)
                new->is_cycled = false;
index c3114e7bb7606660fd37acba146d61a93dfed279..93e2cfd20953640fbd7f86ef49f65e8ec36c21fd 100644 (file)
@@ -244,11 +244,11 @@ RS_execute(Regis *r, char *str)
                switch (ptr->type)
                {
                        case RSF_ONEOF:
-                               if (mb_strchr((char *) ptr->data, c) != true)
+                               if (!mb_strchr((char *) ptr->data, c))
                                        return false;
                                break;
                        case RSF_NONEOF:
-                               if (mb_strchr((char *) ptr->data, c) == true)
+                               if (mb_strchr((char *) ptr->data, c))
                                        return false;
                                break;
                        default:
index 8a99df1356cfdbce44840d8b59052ffd1f0872f9..006023a07ecbca437952b0dfe3736edac034c7d4 100644 (file)
@@ -3903,7 +3903,7 @@ lseg_inside_poly(Point *a, Point *b, POLYGON *poly, int start)
        t.p[1] = *b;
        s.p[0] = poly->p[(start == 0) ? (poly->npts - 1) : (start - 1)];
 
-       for (i = start; i < poly->npts && res == true; i++)
+       for (i = start; i < poly->npts && res; i++)
        {
                Point      *interpt;
 
@@ -3979,7 +3979,7 @@ poly_contain(PG_FUNCTION_ARGS)
                s.p[0] = polyb->p[polyb->npts - 1];
                result = true;
 
-               for (i = 0; i < polyb->npts && result == true; i++)
+               for (i = 0; i < polyb->npts && result; i++)
                {
                        s.p[1] = polyb->p[i];
                        result = lseg_inside_poly(s.p, s.p + 1, polya, 0);
index b0417de1262577ff284a4932b8e114a018206552..4b9e9383298a041708bcaf7246107391fee24f90 100644 (file)
@@ -109,7 +109,7 @@ find_wordentry(TSVector t, TSQuery q, QueryOperand *item, int32 *nitem)
                        StopHigh = StopMiddle;
        }
 
-       if (item->prefix == true)
+       if (item->prefix)
        {
                if (StopLow >= StopHigh)
                        StopMiddle = StopHigh;
index 769509772a11cdc0ae9e86b58041ac89107f19eb..1920f2ad26737bf67590f3a3b450f818b31b4546 100644 (file)
@@ -625,7 +625,7 @@ checkcondition_str(void *checkval, QueryOperand *val)
                        StopHigh = StopMiddle;
        }
 
-       if (res == false && val->prefix == true)
+       if (!res && val->prefix)
        {
                /*
                 * there was a failed exact search, so we should scan further to find
index a5007da09e84e487064838b262814975cef84386..c94607644abe6b43cf844d3098ec02ce92058cf0 100644 (file)
@@ -808,7 +808,7 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
                                        unsigned int nbspace;
 
                                        if (opt_border != 0 ||
-                                               (format->wrap_right_border == false && i > 0))
+                                               (!format->wrap_right_border && i > 0))
                                                fputs(curr_nl_line ? format->header_nl_left : " ",
                                                          fout);
 
@@ -829,7 +829,7 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
                                        else
                                                fprintf(fout, "%*s", width_wrap[i], "");
 
-                                       if (opt_border != 0 || format->wrap_right_border == true)
+                                       if (opt_border != 0 || format->wrap_right_border)
                                                fputs(!header_done[i] ? format->header_nl_right : " ",
                                                          fout);
 
index 3bd6614e72381f358e2e239ec02718365eabf292..1f91878395543aac0fc1250c28255083b708afdb 100644 (file)
@@ -165,7 +165,7 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name)
 
        ecpg_log("ECPGsetcommit on line %d: action \"%s\"; connection \"%s\"\n", lineno, mode, con->name);
 
-       if (con->autocommit == true && strncmp(mode, "off", strlen("off")) == 0)
+       if (con->autocommit && strncmp(mode, "off", strlen("off")) == 0)
        {
                if (PQtransactionStatus(con->connection) == PQTRANS_IDLE)
                {
@@ -176,7 +176,7 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name)
                }
                con->autocommit = false;
        }
-       else if (con->autocommit == false && strncmp(mode, "on", strlen("on")) == 0)
+       else if (!con->autocommit && strncmp(mode, "on", strlen("on")) == 0)
        {
                if (PQtransactionStatus(con->connection) != PQTRANS_IDLE)
                {
index c39b13c6fb5e188a85216836fcee6d09dc7518a9..3b74ba0a4e4f6e5dd88fa64eeae02e5d1b6bd23f 100644 (file)
@@ -353,7 +353,7 @@ ECPG: ClosePortalStmtCLOSEcursor_name block
        }
 ECPG: opt_hold block
        {
-               if (compat == ECPG_COMPAT_INFORMIX_SE && autocommit == true)
+               if (compat == ECPG_COMPAT_INFORMIX_SE && autocommit)
                        $$ = make_str("with hold");
                else
                        $$ = EMPTY;