Skip site navigation (1) Skip section navigation (2)

Comparison with "true" in source code

From: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Comparison with "true" in source code
Date: 2010-11-01 03:17:02
Message-ID: AANLkTineSOuQfuiyT+vLj5jemJ+xC3O8NNDv2QqqiyD1@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
There are some "== true" in the codes, but they might not be safe
because all non-zero values are true in C. Is it worth cleaning up them?

src/backend/access/gin/ginget.c(1364):#define GinIsVoidRes(s)		(
((GinScanOpaque) scan->opaque)->isVoidRes == true )
src/backend/access/gist/gistproc.c(383):		if (allisequal == true && (
src/backend/commands/sequence.c(1107):		Assert(new->is_cycled == false
|| new->is_cycled == true);
src/backend/tsearch/regis.c(251):				if (mb_strchr((char *) ptr->data,
c) == true)
src/backend/utils/adt/geo_ops.c(3899):	for (i = start; i < poly->npts
&& res == true; i++)
src/backend/utils/adt/geo_ops.c(3975):		for (i = 0; i < polyb->npts &&
result == true; i++)
src/backend/utils/adt/tsrank.c(112):	if (item->prefix == true)
src/backend/utils/adt/tsvector_op.c(628):	if (res == false &&
val->prefix == true)
src/include/c.h(475):#define BoolIsValid(boolean)	((boolean) == false
|| (boolean) == true)
src/bin/psql/print.c(832):					if (opt_border != 0 ||
format->wrap_right_border == true)
src/interfaces/ecpg/ecpglib/connect.c(168):	if (con->autocommit ==
true && strncmp(mode, "off", strlen("off")) == 0)
src/interfaces/ecpg/preproc/ecpg.addons(356):		if (compat ==
ECPG_COMPAT_INFORMIX_SE && autocommit == true)
src/interfaces/ecpg/preproc/ecpg.c(310):					ptr2ext[3] = (header_mode
== true) ? 'h' : 'c';
src/interfaces/ecpg/preproc/ecpg.c(327):					ptr2ext[1] = (header_mode
== true) ? 'h' : 'c';

-- 
Itagaki Takahiro

Responses

pgsql-hackers by date

Next:From: Robert HaasDate: 2010-11-01 03:21:21
Subject: Re: SR fails to send existing WAL file after off-line copy
Previous:From: Robert HaasDate: 2010-11-01 03:10:53
Subject: Re: [PATCH] Custom code int(32|64) => text conversions out of performance reasons

Privacy Policy | About PostgreSQL
Copyright © 1996-2013 The PostgreSQL Global Development Group