From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | Andres Freund <andres(at)2ndquadrant(dot)com> |
Cc: | Andrew Dunstan <andrew(at)dunslane(dot)net>, Teodor Sigaev <teodor(at)sigaev(dot)ru>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: jsonb and nested hstore |
Date: | 2014-02-27 01:01:54 |
Message-ID: | 20140227010154.GK4759@eldon.alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2014-02-27 01:06:55 | Re: jsonb and nested hstore |
Previous Message | Kouhei Kaigai | 2014-02-27 00:52:54 | Re: Custom Scan APIs (Re: Custom Plan node) |