Andres Freund wrote:
> On 2014-02-26 16:23:12 -0500, Andrew Dunstan wrote:

> > >>+ if (va->string.len == vb->string.len)
> > >>+ {
> > >>+         res = memcmp(va->string.val, vb->string.val, va->string.len);
> > >>+         if (res == 0 && arg)
> > >>+                 *(bool *) arg = true;
> > >Should be NULL, not 0.
> > 
> > No, the compiler doesn't like that for int values.
> 
> Yes, please disregard, I misread. I think I wanted actually to say that
> the test for arg should be arg != NULL, because we don't usually do
> pointer truth tests (which I personally find odd, but well).

Pointer validity tests seem to be mostly a matter of personal
preference.  I know I sometimes use just "if (foo)" and other times "if
(foo != NULL)".  Both idioms are used inconsistently all over the place.
We even have a PointerIsValid() macro.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to