]> git.ipfire.org Git - thirdparty/postgresql.git/commit
libpq-fe.h: Don't claim SOCKTYPE in the global namespace
authorJacob Champion <jchampion@postgresql.org>
Wed, 17 Dec 2025 19:54:47 +0000 (11:54 -0800)
committerJacob Champion <jchampion@postgresql.org>
Wed, 17 Dec 2025 19:54:47 +0000 (11:54 -0800)
commitcc824482a3c0e6957c252730a62e7460d16a91f4
treecb7a29918cae57ccc085303039929ca7590945e1
parentc8098aa411ee72b36879acba95819100b263f726
libpq-fe.h: Don't claim SOCKTYPE in the global namespace

The definition of PGoauthBearerRequest uses a temporary SOCKTYPE macro
to hide the difference between Windows and Berkeley socket handles,
since we don't surface pgsocket in our public API. This macro doesn't
need to escape the header, because implementers will choose the correct
socket type based on their platform, so I #undef'd it immediately after
use.

I didn't namespace that helper, though, so if anyone else needs a
SOCKTYPE macro, libpq-fe.h will now unhelpfully get rid of it. This
doesn't seem too far-fetched, given its proximity to existing POSIX
macro names.

Add a PQ_ prefix to avoid collisions, update and improve the surrounding
documentation, and backpatch.

Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAOYmi%2BmrGg%2Bn_X2MOLgeWcj3v_M00gR8uz_D7mM8z%3DdX1JYVbg%40mail.gmail.com
Backpatch-through: 18
doc/src/sgml/libpq.sgml
src/interfaces/libpq/libpq-fe.h