Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5aa446c

Browse files
committed
Cleanup various comparisons with the constant "true".
Itagaki Takahiro, with slight modifications.
1 parent 3892a2d commit 5aa446c

File tree

11 files changed

+20
-20
lines changed

11 files changed

+20
-20
lines changed

contrib/pg_upgrade/pg_upgrade.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ copy_clog_xlog_xid(void)
254254

255255
snprintf(old_clog_path, sizeof(old_clog_path), "%s/pg_clog", old_cluster.pgdata);
256256
snprintf(new_clog_path, sizeof(new_clog_path), "%s/pg_clog", new_cluster.pgdata);
257-
if (rmtree(new_clog_path, true) != true)
257+
if (!rmtree(new_clog_path, true))
258258
pg_log(PG_FATAL, "Unable to delete directory %s\n", new_clog_path);
259259
check_ok();
260260

src/backend/access/gin/ginget.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,7 @@ scanGetItem(IndexScanDesc scan, ItemPointer advancePast,
13611361
}
13621362

13631363
#define GinIsNewKey(s) ( ((GinScanOpaque) scan->opaque)->keys == NULL )
1364-
#define GinIsVoidRes(s) ( ((GinScanOpaque) scan->opaque)->isVoidRes == true )
1364+
#define GinIsVoidRes(s) ( ((GinScanOpaque) scan->opaque)->isVoidRes )
13651365

13661366
Datum
13671367
gingetbitmap(PG_FUNCTION_ARGS)

src/backend/access/gist/gistproc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -380,12 +380,12 @@ gist_box_picksplit(PG_FUNCTION_ARGS)
380380
for (i = OffsetNumberNext(FirstOffsetNumber); i <= maxoff; i = OffsetNumberNext(i))
381381
{
382382
cur = DatumGetBoxP(entryvec->vector[i].key);
383-
if (allisequal == true && (
384-
pageunion.high.x != cur->high.x ||
385-
pageunion.high.y != cur->high.y ||
386-
pageunion.low.x != cur->low.x ||
387-
pageunion.low.y != cur->low.y
388-
))
383+
if (allisequal && (
384+
pageunion.high.x != cur->high.x ||
385+
pageunion.high.y != cur->high.y ||
386+
pageunion.low.x != cur->low.x ||
387+
pageunion.low.y != cur->low.y
388+
))
389389
allisequal = false;
390390

391391
adjustBox(&pageunion, cur);

src/backend/commands/sequence.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ init_params(List *options, bool isInit,
11041104
if (is_cycled != NULL)
11051105
{
11061106
new->is_cycled = intVal(is_cycled->arg);
1107-
Assert(new->is_cycled == false || new->is_cycled == true);
1107+
Assert(BoolIsValid(new->is_cycled));
11081108
}
11091109
else if (isInit)
11101110
new->is_cycled = false;

src/backend/tsearch/regis.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,11 @@ RS_execute(Regis *r, char *str)
244244
switch (ptr->type)
245245
{
246246
case RSF_ONEOF:
247-
if (mb_strchr((char *) ptr->data, c) != true)
247+
if (!mb_strchr((char *) ptr->data, c))
248248
return false;
249249
break;
250250
case RSF_NONEOF:
251-
if (mb_strchr((char *) ptr->data, c) == true)
251+
if (mb_strchr((char *) ptr->data, c))
252252
return false;
253253
break;
254254
default:

src/backend/utils/adt/geo_ops.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3903,7 +3903,7 @@ lseg_inside_poly(Point *a, Point *b, POLYGON *poly, int start)
39033903
t.p[1] = *b;
39043904
s.p[0] = poly->p[(start == 0) ? (poly->npts - 1) : (start - 1)];
39053905

3906-
for (i = start; i < poly->npts && res == true; i++)
3906+
for (i = start; i < poly->npts && res; i++)
39073907
{
39083908
Point *interpt;
39093909

@@ -3979,7 +3979,7 @@ poly_contain(PG_FUNCTION_ARGS)
39793979
s.p[0] = polyb->p[polyb->npts - 1];
39803980
result = true;
39813981

3982-
for (i = 0; i < polyb->npts && result == true; i++)
3982+
for (i = 0; i < polyb->npts && result; i++)
39833983
{
39843984
s.p[1] = polyb->p[i];
39853985
result = lseg_inside_poly(s.p, s.p + 1, polya, 0);

src/backend/utils/adt/tsrank.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ find_wordentry(TSVector t, TSQuery q, QueryOperand *item, int32 *nitem)
109109
StopHigh = StopMiddle;
110110
}
111111

112-
if (item->prefix == true)
112+
if (item->prefix)
113113
{
114114
if (StopLow >= StopHigh)
115115
StopMiddle = StopHigh;

src/backend/utils/adt/tsvector_op.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ checkcondition_str(void *checkval, QueryOperand *val)
625625
StopHigh = StopMiddle;
626626
}
627627

628-
if (res == false && val->prefix == true)
628+
if (!res && val->prefix)
629629
{
630630
/*
631631
* there was a failed exact search, so we should scan further to find

src/bin/psql/print.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
808808
unsigned int nbspace;
809809

810810
if (opt_border != 0 ||
811-
(format->wrap_right_border == false && i > 0))
811+
(!format->wrap_right_border && i > 0))
812812
fputs(curr_nl_line ? format->header_nl_left : " ",
813813
fout);
814814

@@ -829,7 +829,7 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
829829
else
830830
fprintf(fout, "%*s", width_wrap[i], "");
831831

832-
if (opt_border != 0 || format->wrap_right_border == true)
832+
if (opt_border != 0 || format->wrap_right_border)
833833
fputs(!header_done[i] ? format->header_nl_right : " ",
834834
fout);
835835

src/interfaces/ecpg/ecpglib/connect.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name)
165165

166166
ecpg_log("ECPGsetcommit on line %d: action \"%s\"; connection \"%s\"\n", lineno, mode, con->name);
167167

168-
if (con->autocommit == true && strncmp(mode, "off", strlen("off")) == 0)
168+
if (con->autocommit && strncmp(mode, "off", strlen("off")) == 0)
169169
{
170170
if (PQtransactionStatus(con->connection) == PQTRANS_IDLE)
171171
{
@@ -176,7 +176,7 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name)
176176
}
177177
con->autocommit = false;
178178
}
179-
else if (con->autocommit == false && strncmp(mode, "on", strlen("on")) == 0)
179+
else if (!con->autocommit && strncmp(mode, "on", strlen("on")) == 0)
180180
{
181181
if (PQtransactionStatus(con->connection) != PQTRANS_IDLE)
182182
{

src/interfaces/ecpg/preproc/ecpg.addons

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ ECPG: ClosePortalStmtCLOSEcursor_name block
353353
}
354354
ECPG: opt_hold block
355355
{
356-
if (compat == ECPG_COMPAT_INFORMIX_SE && autocommit == true)
356+
if (compat == ECPG_COMPAT_INFORMIX_SE && autocommit)
357357
$$ = make_str("with hold");
358358
else
359359
$$ = EMPTY;

0 commit comments

Comments
 (0)