Re: Patch to implement pg_current_logfile() function

Поиск
Список
Период
Сортировка
От Gilles Darold
Тема Re: Patch to implement pg_current_logfile() function
Дата
Msg-id cec5437e-6cc0-bebd-59dc-1f33fe4b2a97@dalibo.com
обсуждение исходный текст
Ответ на Re: Patch to implement pg_current_logfile() function  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Le 23/11/2016 à 16:26, Tom Lane a écrit :
> "Karl O. Pinc" <kop@meme.com> writes:
>> Maybe on the 2nd call to strtok() you could pass ""
>> as the 2nd argument?  That'd be a little wonky but
>> the man page does not say you can't have an empty
>> set of delimiters.  On the other hand strtok() is
>> not a perfect choice, you don't want to "collapse"
>> adjacent delimiters in the parsed string or ignore
>> leading spaces.  I'd prefer a strstr() solution.
> I'd stay away from strtok() no matter what.  The process-wide static
> state it implies is dangerous: if you use it, you're betting that
> you aren't interrupting some caller's use, nor will any callee decide
> to use it.  In a system as large as Postgres, that's a bad bet, or
> would be if we didn't discourage use of strtok() pretty hard.
>
> As far as I can find, there are exactly two users of strtok() in
> the backend, and they're already playing with fire because one
> calls the other (look in utils/misc/tzparser.c).  I don't want the
> hazard to get any larger.
>
>             regards, tom lane

Understood, I will remove and replace this call from the patch and more
generally from my programming.

-- 
Gilles Darold
Consultant PostgreSQL
http://dalibo.com - http://dalibo.org




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

Предыдущее
От: Kostiantyn Nemchenko
Дата:
Сообщение: Typo in comment in file analyze.c [master branch]
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Typo in comment in file analyze.c [master branch]