Re: replace strtok()

2024-07-23 Thread Peter Eisentraut
On 08.07.24 07:45, David Steele wrote: On 6/24/24 19:57, Peter Eisentraut wrote: On 24.06.24 02:34, Michael Paquier wrote: On Sat, Jun 22, 2024 at 11:48:21AM -0400, Tom Lane wrote: Peter Eisentraut writes: On 18.06.24 13:43, Ranier Vilela wrote: I found another implementation of strsep, it

Re: replace strtok()

2024-07-07 Thread David Steele
On 6/24/24 19:57, Peter Eisentraut wrote: On 24.06.24 02:34, Michael Paquier wrote: On Sat, Jun 22, 2024 at 11:48:21AM -0400, Tom Lane wrote: Peter Eisentraut writes: On 18.06.24 13:43, Ranier Vilela wrote: I found another implementation of strsep, it seems lighter to me. I will attach it fo

Re: replace strtok()

2024-06-24 Thread Peter Eisentraut
On 24.06.24 02:34, Michael Paquier wrote: On Sat, Jun 22, 2024 at 11:48:21AM -0400, Tom Lane wrote: Peter Eisentraut writes: On 18.06.24 13:43, Ranier Vilela wrote: I found another implementation of strsep, it seems lighter to me. I will attach it for consideration, however, I have not done a

Re: replace strtok()

2024-06-23 Thread Michael Paquier
On Sat, Jun 22, 2024 at 11:48:21AM -0400, Tom Lane wrote: > Peter Eisentraut writes: > > On 18.06.24 13:43, Ranier Vilela wrote: > >> I found another implementation of strsep, it seems lighter to me. > >> I will attach it for consideration, however, I have not done any testing. > > > Yeah, surely

Re: replace strtok()

2024-06-22 Thread Tom Lane
Peter Eisentraut writes: > On 18.06.24 13:43, Ranier Vilela wrote: >> I found another implementation of strsep, it seems lighter to me. >> I will attach it for consideration, however, I have not done any testing. > Yeah, surely there are many possible implementations. I'm thinking, > since we a

Re: replace strtok()

2024-06-22 Thread Peter Eisentraut
On 18.06.24 13:43, Ranier Vilela wrote: But I would like to see more const char * where this is possible. For example, in pg_locale.c IMO, the token variable can be const char *. At least strchr expects a const char * as the first parameter. This would not be future-proof. In C23, if you pas

Re: replace strtok()

2024-06-19 Thread Kyotaro Horiguchi
At Tue, 18 Jun 2024 09:18:28 +0200, Peter Eisentraut wrote in > Under the topic of getting rid of thread-unsafe functions in the > backend [0], here is a patch series to deal with strtok(). > > Of course, strtok() is famously not thread-safe and can be replaced by > strtok_r(). But it also has

Re: replace strtok()

2024-06-18 Thread Ranier Vilela
Em ter., 18 de jun. de 2024 às 04:18, Peter Eisentraut escreveu: > Under the topic of getting rid of thread-unsafe functions in the backend > [0], here is a patch series to deal with strtok(). > > Of course, strtok() is famously not thread-safe and can be replaced by > strtok_r(). But it also ha

replace strtok()

2024-06-18 Thread Peter Eisentraut
Under the topic of getting rid of thread-unsafe functions in the backend [0], here is a patch series to deal with strtok(). Of course, strtok() is famously not thread-safe and can be replaced by strtok_r(). But it also has the wrong semantics in some cases, because it considers adjacent delim