mirror of
https://github.com/postgres/postgres.git
synced 2025-12-19 17:02:53 +03:00
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
This commit is contained in:
@@ -10422,10 +10422,14 @@ typedef struct PGoauthBearerRequest
|
||||
|
||||
/* Hook outputs */
|
||||
|
||||
/* Callback implementing a custom asynchronous OAuth flow. */
|
||||
/*
|
||||
* Callback implementing a custom asynchronous OAuth flow. The signature is
|
||||
* platform-dependent: PQ_SOCKTYPE is SOCKET on Windows, and int everywhere
|
||||
* else.
|
||||
*/
|
||||
PostgresPollingStatusType (*async) (PGconn *conn,
|
||||
struct PGoauthBearerRequest *request,
|
||||
SOCKTYPE *altsock);
|
||||
PQ_SOCKTYPE *altsock);
|
||||
|
||||
/* Callback to clean up custom allocations. */
|
||||
void (*cleanup) (PGconn *conn, struct PGoauthBearerRequest *request);
|
||||
@@ -10482,7 +10486,7 @@ typedef struct PGoauthBearerRequest
|
||||
hook. When the callback cannot make further progress without blocking,
|
||||
it should return either <symbol>PGRES_POLLING_READING</symbol> or
|
||||
<symbol>PGRES_POLLING_WRITING</symbol> after setting
|
||||
<literal>*pgsocket</literal> to the file descriptor that will be marked
|
||||
<literal>*altsock</literal> to the file descriptor that will be marked
|
||||
ready to read/write when progress can be made again. (This descriptor
|
||||
is then provided to the top-level polling loop via
|
||||
<function>PQsocket()</function>.) Return <symbol>PGRES_POLLING_OK</symbol>
|
||||
|
||||
Reference in New Issue
Block a user