Re: Unnecessary pointer-NULL checks in pgp-pgsql.c

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Unnecessary pointer-NULL checks in pgp-pgsql.c
Date: 2015-02-04 12:00:08
Message-ID: CAB7nPqTjxxm1iO+hKg=FhCMbHRGM3HjtXQEyRKit8bt39t3O3A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas wrote:
> I wrote:
>> src, dst and ctx are created respectively from mbuf_create_from_data,
>> mbuf_create and pgp_init which never return NULL and they are palloc'd
>> all the time. I think that we could simplify things with the patch
>> attached, note that I added an assertion for correctness but I don't
>> really think that it is much necessary.
>
> Yeah, I'd drop the assertion. Also, how about changing things around
> slightly so that we lose the goto-label construct? There's only one
> goto, and its only about 6 lines before the label, so we could just
> flip the sense of the if-test and put the code that gets skipped
> inside the if-block.
Good idea. This gives the patch attached then.
Regards,
--
Michael

Attachment Content-Type Size
20150204_pgcrypto_fixes_v2.patch text/x-patch 1.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2015-02-04 12:59:55 Re: Small memory leak in execute.c of ECPG driver
Previous Message Marko Tiikkaja 2015-02-04 11:42:01 Re: Fetch zero result rows when executing a query?