Re: jsonb and nested hstore - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: jsonb and nested hstore
Date
Msg-id 20140227010154.GK4759@eldon.alvh.no-ip.org
Whole thread Raw
In response to Re: jsonb and nested hstore  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Kouhei Kaigai
Date:
Subject: Re: Custom Scan APIs (Re: Custom Plan node)
Next
From: Alvaro Herrera
Date:
Subject: Re: jsonb and nested hstore