Re: taking stdbool.h into use
Michael Paquier <michael.paquier@gmail.com>
From: Michael Paquier <michael.paquier@gmail.com>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>, Thomas Munro <thomas.munro@enterprisedb.com>
Date: 2017-11-08T23:19:52Z
Lists: pgsql-hackers
On Thu, Nov 9, 2017 at 1:46 AM, Peter Eisentraut <peter.eisentraut@2ndquadrant.com> wrote: > On 10/29/17 08:50, Michael Paquier wrote: >> I spotted a couple of other things while looking at your patches and >> the code tree. >> >> - return (ginCompareItemPointers(&btree->itemptr, iptr) > 0) ? TRUE : FALSE; >> + return (ginCompareItemPointers(&btree->itemptr, iptr) > 0) ? true : false; >> You could simplify that at the same time by removing such things. The >> "false : true" pattern is less frequent than the "true : false" >> pattern. > > I have found many more instances like that. It might be worth > simplifying a bit, but that sounds like a separate undertaking. Yeah, I just mentioned one for reference. And I can see 66 instances. It may be not worth changing either to simplify back-patching. >> Some comments in the code still mention FALSE or TRUE: >> - hashsearch.c uses FALSE in some comments. >> - In execExpr.c, ExecCheck mentions TRUE. > > That one is an SQL TRUE, so I left it. Oops. You are right. I tried to be careful with what was referring to SQL and C. -- Michael
Commits
-
Use stdbool.h if suitable
- 9a95a77d9d5d 11.0 landed
-
Add configure tests for stdbool.h and sizeof bool
- f20b3285340c 11.0 landed
-
Remove useless use of bit-masking macros
- d91da5ecedc8 11.0 landed
-
Change various Gin*Is* macros to return 0/1.
- af4472bcb88a 9.6.0 cited
-
Fix several possibly non-portable gaffs in record_image_ops.
- 4cbb646334b3 9.4.0 cited