plsample: Use TextDatumGetCString() for text-to-CString conversion

Replace the outdated DatumGetCString(DirectFunctionCall1(textout, ...))
pattern with TextDatumGetCString(). The macro is the modern, more
efficient way to convert a text Datum to a C string as it avoids
unnecessary function call machinery and handles detoasting internally.

Since plsample serves as reference code for extension authors, it
should follow current idiomatic practices.

Author: Amul Sul <[email protected]>
Discussion: 
https://postgr.es/m/caaj_b95-xmvun1peqxv8y6g-a-8k+fsgyv20kszc9ef1wza...@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f1cfb48efb086f99f6995f5d4b8a7c3ee289d1f0

Modified Files
--------------
src/test/modules/plsample/plsample.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

Reply via email to