Commit cc402116 authored by Tom Lane's avatar Tom Lane

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.
parent 1d4a0ab1
......@@ -121,14 +121,14 @@ GetForeignServer(Oid serverid)
tp,
Anum_pg_foreign_server_srvtype,
&isnull);
server->servertype = isnull ? NULL : pstrdup(TextDatumGetCString(datum));
server->servertype = isnull ? NULL : TextDatumGetCString(datum);
/* Extract server version */
datum = SysCacheGetAttr(FOREIGNSERVEROID,
tp,
Anum_pg_foreign_server_srvversion,
&isnull);
server->serverversion = isnull ? NULL : pstrdup(TextDatumGetCString(datum));
server->serverversion = isnull ? NULL : TextDatumGetCString(datum);
/* Extract the srvoptions */
datum = SysCacheGetAttr(FOREIGNSERVEROID,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment