Re: libpq: Remove redundant null pointer checks before free()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: libpq: Remove redundant null pointer checks before free()
Date: 2022-06-19 17:38:31
Message-ID: 2216816.1655660311@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> For PQclear() specifically, one thing that I thought a few days ago
> would be useful would to have it return (PGresult *) NULL. Then the
> very common pattern of doing "PQclear(res); res = NULL;" could be
> simplified to "res = PQclear(res);", which is nicely compact and is
> learned instantly.

That's a public API unfortunately, and so some people would demand
a libpq.so major version bump if we changed it.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-06-20 00:03:23 Re: Add header support to text format and matching feature
Previous Message Alvaro Herrera 2022-06-19 09:55:33 Re: libpq: Remove redundant null pointer checks before free()