Re: Comparison with "true" in source code

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Comparison with "true" in source code
Date: 2010-11-02 17:19:42
Message-ID: 20101102171942.GA21179@hyperion.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Nov 01, 2010 at 12:17:02PM +0900, Itagaki Takahiro wrote:
> 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/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';

I actually see no reason why these variables are not defined as bool instead of
int, so I changed this. Hopefully I found all of them.

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
Jabber: michael.meskes at googlemail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2010-11-02 17:33:15 Re: [PATCH] V3: Idle in transaction cancellation
Previous Message Peter Eisentraut 2010-11-02 16:15:38 ALTER TYPE recursion to typed tables