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

From: Dmitry Mityugov <d(dot)mityugov(at)postgrespro(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PATCH] Use strchr() to search for a single character
Date: 2025-07-20 22:21:38
Message-ID: 9c1beea6c7a5e9fb6677f26620f1f257@postgrespro.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
0001-Use-strchr-to-search-for-a-single-character.patch text/x-diff 1.0 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Treat 2025-07-20 23:54:38 Re: [PATCH] Proposal to Enable/Disable Index using ALTER INDEX
Previous Message Rishu Bagga 2025-07-20 22:06:46 Re: Proposal: Out-of-Order NOTIFY via GUC to Improve LISTEN/NOTIFY Throughput