clone varlena function

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: clone varlena function
Date: 2008-02-02 21:23:10
Message-ID: 162867790802021323h6a81ba4dn617c51c290751cbd@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

I am cleaning orafce module and I would to eliminate duplicit code
with core. Is in core similar macro or function?

text*
ora_clone_text(text *t)
{
text *result;

result = palloc(VARSIZE(t));
SET_VARSIZE(result, VARSIZE(t));
memcpy(VARDATA(result), VARDATA(t), VARSIZE(t) - VARHDRSZ);

return result;
}

It can be used for any varlena datatype.

Thank you
Pavel Stehule

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2008-02-02 21:37:32 Re: configurability of OOM killer
Previous Message Florian G. Pflug 2008-02-02 20:49:05 Re: configurability of OOM killer