[PATCH] Use strchr() to search for a single character
Dmitry Mityugov <d.mityugov@postgrespro.ru>
From: Dmitry Mityugov <d.mityugov@postgrespro.ru>
To: pgsql-hackers@postgresql.org
Date: 2025-07-20T22:21:38Z
Lists: pgsql-hackers
Attachments
- 0001-Use-strchr-to-search-for-a-single-character.patch (text/x-diff) patch 0001
Code in src/port/pgmkdirp.c uses strstr() to find a single character in a string, but strstr() seems to be too generic for this job. Another function, strchr(), might be better suited for this purpose, because it is optimized to search for exactly one character in a string. In addition, if strchr() is used, the compiler doesn't have to generate a terminating \0 byte for the substring, producing slightly smaller code. I'm attaching the patch. Regards, Dmitry
Commits
-
Use strchr instead of strstr for single-char lookups
- 039f7ee0fe9a 19 (unreleased) landed