Re: [PATCH] Use strchr() to search for a single character

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: [PATCH] Use strchr() to search for a single character
Дата
Msg-id CAApHDvopwsSNw1CGxuDU9i70Tj-PvzniYaNQOXbSxAJW37WiFA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] Use strchr() to search for a single character  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [PATCH] Use strchr() to search for a single character
Список pgsql-hackers
On Wed, 23 Jul 2025 at 10:36, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> David Rowley <dgrowleyml@gmail.com> writes:
> > Looking at [1], it seems even ancient versions of gcc and clang
> > rewrite the strstr() into a strchr() call when the search term is a
> > single char string. So it might not be worth doing to any trouble
> > here.
>
> I was wondering if that might be true.  However, your godbolt results
> show that MSVC doesn't do this optimization, and the usage in
> pgmkdirp.c is inside "#ifdef WIN32", so maybe it's worth fixing there.

Yeah, I noticed MSVC not doing the rewrite. I didn't notice the
mentioned use case was within an #ifdef WIN32.

I'm currently thinking we should just fix the pgmkdirp.c instance and
call it good.

David



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