returning modified input from C functions

Поиск
Список
Период
Сортировка
Искать

returning modified input from C functions

От:
strk <strk@keybit.net>
Дата:
Is returning a pointer to the input safe in every case ?

--strk;

Re: returning modified input from C functions

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
strk  writes:
> Is returning a pointer to the input safe in every case ?

You mean for returning *unmodified* input, don't you?

Yes, that's safe.  Scribbling on input values is definitely never safe.
		regards, tom lane

Re: returning modified input from C functions

От:
strk <strk@keybit.net>
Дата:
On Mon, Aug 23, 2004 at 03:20:09PM -0400, Tom Lane wrote:
> strk  writes:
> > Is returning a pointer to the input safe in every case ?
> 
> You mean for returning *unmodified* input, don't you?
> 
> Yes, that's safe.  Scribbling on input values is definitely never safe.
> 
> 			regards, tom lane

I meant scribbling actually.
Would PG_DETOAST_DATUM_COPY() make it safe then ?

--strk;


Re: returning modified input from C functions

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
strk  writes:
> I meant scribbling actually.
> Would PG_DETOAST_DATUM_COPY() make it safe then ?

Yup, that's what it's for.
		regards, tom lane

FAQ