Le 23/11/2016 à 16:26, Tom Lane a écrit : > "Karl O. Pinc" <k...@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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers