Re: Suspicious strcmp() in src/backend/parser/parse_expr.c

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: Andrew Gierth <andrew@tao11.riddles.org.uk>, Rikard Falkeborn <rikard.falkeborn@gmail.com>, pgsql-bugs@lists.postgresql.org
Date: 2019-04-11T04:55:49Z
Lists: pgsql-bugs
Michael Paquier <michael@paquier.xyz> writes:
> On Wed, Apr 10, 2019 at 06:43:32PM -0400, Tom Lane wrote:
>> Indeed.  Considering how much I hate using strcmp's result as a boolean,
>> you'd think I'd have got that right.  Thanks for noticing!

> Would it be worth changing these as well?

I'd be +1 for that, just on the grounds of having consistent coding
style.  But I'm not sufficiently excited about it to do the work
myself ...

			regards, tom lane



Commits

  1. Fix more strcmp() calls using boolean-like comparisons for result checks

  2. Fix backwards test in operator_precedence_warning logic.