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