From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove redundant SvOK() tests in plperl.
Date: Thu, 20 Aug 2026 15:26:27 +0000
Message-ID: <E1wx4ew-00000001NQK-2Cj5@gemulon.postgresql.org> (raw)
Remove redundant SvOK() tests in plperl.
I noticed that some places in our code test "SvOK(sv) && SvROK(sv)"
while others check just SvROK(sv). On investigation, it's clear
that SvROK implies SvOK so testing both is pointless. While removing
these extra checks seems very unlikely to make any performance
difference, it does make the code more consistent and intelligible.
Also mop up a couple of places where there wasn't a null-pointer
check before a SvOK() test. I think these are unreachable cases,
but in the name of consistency let's do it the same everywhere.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Discussion: https://postgr.es/m/2034677.1787172042@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/41868e8aaa6cfff63b1c8010e1356e01d86a1326
Modified Files
--------------
src/pl/plperl/plperl.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Remove redundant SvOK() tests in plperl.
In-Reply-To: <E1wx4ew-00000001NQK-2Cj5@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox