On 02/26/2014 04:59 PM, Peter Geoghegan wrote:
> On Wed, Feb 26, 2014 at 1:23 PM, Andrew Dunstan <andrew@dunslane.net> 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.
> I'm confused. I just pulled from feodor/jsonb_and_hstore, and I do see
> a compiler warning (because the code reads "res == NULL", unlike
> above). It appears to have been that way in Git since last year. So,
> maybe Andres meant that it *should* look like this?
>
>
argh!
I forgot to save a file.
Here's what I get if it's NULL:
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels
-Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
-fwrapv -fexcess-precision=standard -g -I../../../../src/include
-D_GNU_SOURCE -I/usr/include/libxml2 -c -o jsonb_support.o
jsonb_support.c -MMD -MP -MF .deps/jsonb_support.Po
jsonb_support.c: In function ‘compareJsonbStringValue’:
jsonb_support.c:137:11: warning: comparison between pointer and
integer [enabled by default]
With 0 there is no complaint.
new patch attached, change pushed to github.
cheers
andrew