Re: Comparison with "true" in source code - Mailing list pgsql-hackers

From Michael Meskes
Subject Re: Comparison with "true" in source code
Date
Msg-id 20101102171942.GA21179@hyperion.credativ.de
Whole thread Raw
In response to Comparison with "true" in source code  (Itagaki Takahiro <itagaki.takahiro@gmail.com>)
Responses Re: Comparison with "true" in source code
List 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


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: ALTER TYPE recursion to typed tables
Next
From: "Kevin Grittner"
Date:
Subject: Re: [PATCH] V3: Idle in transaction cancellation