Re: [PATCH] Cleanup: Compare pointers to NULL instead of 0

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Marti Raudsepp <marti(at)juffo(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Cleanup: Compare pointers to NULL instead of 0
Date: 2010-10-29 20:11:18
Message-ID: 1288381769-sup-6814@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Excerpts from Marti Raudsepp's message of vie oct 29 13:25:03 -0300 2010:
> Coccinelle found a few places in the code where pointer expressions
> were compared to 0. I have changed them to NULL instead.
>
> There was one line that I didn't dare to touch, which looks like a
> false positive.
>
> src/backend/regex/regc_lex.c:849:
> if (v->now - save == 0 || ((int) c > 0 && (int) c <= v->nsubexp))
>
> I couldn't find the definition of v (struct vars) anywhere. Is it
> comparing two pointers here? Should it be "v->now == save" instead?

regcomp.c line 198. Yes, it's a pointer.

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-10-29 20:23:36 Re: plan time of MASSIVE partitioning ...
Previous Message Leonardo Francalanci 2010-10-29 20:08:57 Re: plan time of MASSIVE partitioning ...