summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2020-11-17 02:23:56 +0100
committerLionel Mamane <lionel@mamane.lu>2020-12-18 08:48:29 +0100
commitb815bc466695cd1700a2c8d0cdc5201ed5a95032 (patch)
tree93d22e737e023335a7d6dd71fb8d122ce1597229 /connectivity
parentd9b8670548561f7f53a546b8fe53212c6b1ce26e (diff)
pgsql-sdbc small optimisation
1) use const unique_ptr since we don't need the value to survive the scope in any way. 2) put the custom deleter function (PQconninfoFree) in the ptr class rather than at runtime. Saves one pointer in the ptr class and reduces the ptr class overhead... Change-Id: I914baa0d8ae0426322fd343f5163d09f43c4c41c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105968 Tested-by: Jenkins Reviewed-by: Lionel Mamane <lionel@mamane.lu>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/postgresql/pq_connection.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx
index 4d56d52ec9a9..5d97f2b2436d 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.cxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.cxx
@@ -453,7 +453,8 @@ void Connection::initialize( const Sequence< Any >& aArguments )
if ( o.getLength() > 0 )
{
char *err;
- std::shared_ptr<PQconninfoOption> oOpts(PQconninfoParse(o.getStr(), &err), PQconninfoFree);
+ const std::unique_ptr<PQconninfoOption, deleter_from_fn<PQconninfoFree>>
+ oOpts(PQconninfoParse(o.getStr(), &err));
if (oOpts == nullptr)
{
OUString errorMessage;