From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Remove useless pstrdups in untransformRelOptions |
Date: | 2022-09-13 10:00:15 |
Message-ID: | E1oY2iF-0008wJ-00@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Remove useless pstrdups in untransformRelOptions
The two strings are already a single palloc'd chunk, not freed; there's
no reason to allocate separate copies that have the same lifetime.
This code is only called in short-lived memory contexts (except in some
cases in TopTransactionContext, which is still short-lived enough not to
really matter), and typically only for short arrays, so the memory or
computation saved is likely negligible. However, let's fix it to avoid
leaving a bad example of code to copy. This is the only place I could
find where we're doing this with makeDefElem().
Reported-by: Junwang Zhao <zhjwpku(at)gmail(dot)com>
Discussion: https://postgr.es/m/20220909142050.3vv2hjekppk265dd@alvherre.pgsql
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/6710e83a675eda798544fea4cdcb89eef7f39403
Modified Files
--------------
src/backend/access/common/reloptions.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2022-09-13 10:06:12 | pgsql: Improve wal_decode_buffer_size description some more |
Previous Message | John Naylor | 2022-09-13 09:58:39 | pgsql: Adjust header exceptions for 0bd9c6297 |