Skip to content

Commit cc40211

Browse files
committed
Remove a couple of useless pstrdup() calls.
There's no point in pstrdup'ing the result of TextDatumGetCString, since that's necessarily already a freshly-palloc'd C string. These particular calls are unlikely to be of any consequence performance-wise, but still they're a bad precedent that can confuse future patch authors. Noted by Chapman Flack.
1 parent 1d4a0ab commit cc40211

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/foreign/foreign.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,14 @@ GetForeignServer(Oid serverid)
121121
tp,
122122
Anum_pg_foreign_server_srvtype,
123123
&isnull);
124-
server->servertype = isnull ? NULL : pstrdup(TextDatumGetCString(datum));
124+
server->servertype = isnull ? NULL : TextDatumGetCString(datum);
125125

126126
/* Extract server version */
127127
datum = SysCacheGetAttr(FOREIGNSERVEROID,
128128
tp,
129129
Anum_pg_foreign_server_srvversion,
130130
&isnull);
131-
server->serverversion = isnull ? NULL : pstrdup(TextDatumGetCString(datum));
131+
server->serverversion = isnull ? NULL : TextDatumGetCString(datum);
132132

133133
/* Extract the srvoptions */
134134
datum = SysCacheGetAttr(FOREIGNSERVEROID,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy