clone varlena function

Started by Pavel Stehuleabout 18 years ago3 messageshackers
Jump to latest
#1Pavel Stehule
pavel.stehule@gmail.com

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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Pavel Stehule (#1)
Re: clone varlena function

"Pavel Stehule" <pavel.stehule@gmail.com> writes:

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

datumCopy?

regards, tom lane

#3Pavel Stehule
pavel.stehule@gmail.com
In reply to: Tom Lane (#2)
Re: clone varlena function

On 02/02/2008, Tom Lane <tgl@sss.pgh.pa.us> wrote:

"Pavel Stehule" <pavel.stehule@gmail.com> writes:

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

datumCopy?

yes, it is it.

thank you

Pavel Stehule

Show quoted text

regards, tom lane