more POSIX 2008 cleanup: strnlen(), rindex()
Peter Eisentraut <peter@eisentraut.org>
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2026-01-03T09:51:53Z
Lists: pgsql-hackers
Attachments
- 0001-strnlen-is-now-required.patch (text/plain) patch 0001
- 0002-Remove-use-of-rindex-function.patch (text/plain) patch 0002
It has previously been established that POSIX 2008 is the baseline for PostgreSQL code (modulo Windows). Looking through the POSIX 2008 changes, I found a few more things we can clean up with respect to that. The first patch removes the configure checks for strnlen(), since that is now required, and I see that all buildfarm members support. There was some discussion in the commit messages that added these checks (e.g., commit 8a241792f96) that suggests it was once required, but I did not find any information about which platforms were affected then. But that's 8 years ago now, so I think it might be obsolete. The second patch replaces the single remaining use of rindex() with the equivalent strrchr(). rindex() has been removed from POSIX.
Commits
-
Remove use of rindex() function
- 6ade3cd459f5 19 (unreleased) landed
-
strnlen() is now required
- 5e7abdac9913 19 (unreleased) landed
-
Add pg_strnlen() a portable implementation of strlen.
- 8a241792f968 11.0 cited