pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: libpq-fe.h: Don't claim SOCKTYPE in the global namespace
2+ messages / 1 participants
[nested] [flat]

* pgsql: libpq-fe.h: Don't claim SOCKTYPE in the global namespace
@ 2025-12-17 20:34 Jacob Champion <jchampion@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Jacob Champion @ 2025-12-17 20:34 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8b217c96ea2d0cf5046092aef03612f46bb136e4

Modified Files
--------------
doc/src/sgml/libpq.sgml         | 10 +++++++---
src/interfaces/libpq/libpq-fe.h | 17 ++++++++++++-----
2 files changed, 19 insertions(+), 8 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: libpq-fe.h: Don't claim SOCKTYPE in the global namespace
@ 2025-12-17 20:34 Jacob Champion <jchampion@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Jacob Champion @ 2025-12-17 20:34 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/cc824482a3c0e6957c252730a62e7460d16a91f4

Modified Files
--------------
doc/src/sgml/libpq.sgml         | 10 +++++++---
src/interfaces/libpq/libpq-fe.h | 17 ++++++++++++-----
2 files changed, 19 insertions(+), 8 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-12-17 20:34 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-12-17 20:34 pgsql: libpq-fe.h: Don't claim SOCKTYPE in the global namespace Jacob Champion <jchampion@postgresql.org>
2025-12-17 20:34 pgsql: libpq-fe.h: Don't claim SOCKTYPE in the global namespace Jacob Champion <jchampion@postgresql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox