Re: C Extension woes

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: C Extension woes
Дата
Msg-id 18797.1218638066@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: C Extension woes  (Andrew Chernow <ac@esilo.com>)
Список pgsql-hackers
Andrew Chernow <ac@esilo.com> writes:
> Tim Hawes wrote:
>> char *e_var = getenv("PGMASTERKEY");
>> size_t length = VARSIZE(e_var) - VARHDRSZ;

> The VARSIZE macro is for variable length structures, like a text or 
> bytea which contains a length and data member.  You are using this macro 
> on a regular C string "e_var".

The code on the output side is wrong too: if the useful data length is
"length", then the palloc has to ask for length + VARHDRSZ, and that's
also what's got to be put into the length word.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: Replay attack of query cancel
Следующее
От: "Michael Nacos"
Дата:
Сообщение: Re: Overhauling GUCS