From: | Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Comparison with "true" in source code |
Date: | 2010-11-04 01:45:14 |
Message-ID: | AANLkTinY14ToJ2gWX-zm55ffj_e9qCLPGX=4FuW1BkLh@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Nov 3, 2010 at 2:19 AM, Michael Meskes <meskes(at)postgresql(dot)org> wrote:
> 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?
Here is a proposed cleanup that replaces "boolean == true" with "boolean".
I didn't touch "== false" unless they are not in pairs of comparisons
with true because comparison with false is a valid C code.
Note that I also changed "boolean != true" in pg_upgrade,
but I didn't change ones in xlog.c because it might check
corrupted fields in control files.
>> src/interfaces/ecpg/preproc/ecpg.c(310):
>> ptr2ext[3] = (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.
I added an additional cleanup to 'header_mode' in ecpg; I changed the type
from bool to char to hold 'h' or 'c'. Do you think it is reasonable?
--
Itagaki Takahiro
Attachment | Content-Type | Size |
---|---|---|
bool_eq_true_cleanup.patch | application/octet-stream | 11.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Vaibhav Kaushal | 2010-11-04 02:30:17 | Can we talk about a version which has already been developed? |
Previous Message | Fujii Masao | 2010-11-04 01:27:33 | Re: timestamp of the last replayed transaction |