Re: replace strtok() - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: replace strtok()
Date
Msg-id Zni-_fUq49SNSyir@paquier.xyz
Whole thread Raw
In response to Re: replace strtok()  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: replace strtok()
List pgsql-hackers
On Sat, Jun 22, 2024 at 11:48:21AM -0400, Tom Lane wrote:
> Peter Eisentraut <peter@eisentraut.org> 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 already took other str*() functions from OpenBSD, it makes
> > sense to do this here as well, so we have only one source to deal with.
>
> Why not use strpbrk?  That's equally thread-safe, it's been there
> since C89, and it doesn't have the problem that you can't find out
> which of the delimiter characters was found.

Yeah, strpbrk() has been used in the tree as far as 2003 without any
port/ implementation.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Ranier Vilela
Date:
Subject: Re: Avoid incomplete copy string (src/backend/access/transam/xlog.c)
Next
From: Michael Paquier
Date:
Subject: Re: Avoid incomplete copy string (src/backend/access/transam/xlog.c)