Skip to content

Commit eca0506

Browse files
committed
Unify GVL wrappers to missing libpq functions
To avoid overly complicated or duplicated definitions.
1 parent ba18e24 commit eca0506

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

ext/gvl_wrappers.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ PostgresPollingStatusType PQcancelPoll(PGcancelConn *cancelConn){return PGRES_PO
1919
#ifndef LIBPQ_HAS_PIPELINING
2020
int PQpipelineSync(PGconn *conn){return 0;}
2121
#endif
22+
#ifndef LIBPQ_HAS_PROMPT_OAUTH_DEVICE
23+
int auth_data_hook_proxy(PGauthData type, PGconn *conn, void *data){return 0;}
24+
#endif
2225

2326
#ifdef ENABLE_GVL_UNLOCK
2427
FOR_EACH_BLOCKING_FUNCTION( DEFINE_GVL_WRAPPER_STRUCT );

ext/gvl_wrappers.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
#ifndef LIBPQ_HAS_CHUNK_MODE
2525
typedef struct pg_cancel_conn PGcancelConn;
2626
#endif
27+
#ifndef LIBPQ_HAS_PROMPT_OAUTH_DEVICE
28+
typedef enum { DUMMY_TYPE } PGauthData;
29+
#endif
2730

2831
#define DEFINE_PARAM_LIST1(type, name) \
2932
name,
@@ -291,23 +294,12 @@ FOR_EACH_BLOCKING_FUNCTION( DEFINE_GVL_STUB_DECL );
291294
#define FOR_EACH_PARAM_OF_notice_receiver_proxy(param) \
292295
param(void *, arg)
293296

294-
#ifdef LIBPQ_HAS_PROMPT_OAUTH_DEVICE
295-
296297
/* function( name, void_or_nonvoid, returntype, lastparamtype, lastparamname ) */
297298
#define FOR_EACH_CALLBACK_FUNCTION(function) \
298299
function(auth_data_hook_proxy, GVL_TYPE_NONVOID, int, void *, data) \
299300
function(notice_processor_proxy, GVL_TYPE_VOID, void, const char *, message) \
300301
function(notice_receiver_proxy, GVL_TYPE_VOID, void, const PGresult *, result) \
301302

302-
#else
303-
304-
/* function( name, void_or_nonvoid, returntype, lastparamtype, lastparamname ) */
305-
#define FOR_EACH_CALLBACK_FUNCTION(function) \
306-
function(notice_processor_proxy, GVL_TYPE_VOID, void, const char *, message) \
307-
function(notice_receiver_proxy, GVL_TYPE_VOID, void, const PGresult *, result) \
308-
309-
#endif
310-
311303
FOR_EACH_CALLBACK_FUNCTION( DEFINE_GVL_STUB_DECL );
312304

313305

ext/pg_auth_hooks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include "pg.h"
88

9-
#if LIBPQ_HAS_PROMPT_OAUTH_DEVICE
9+
#ifdef LIBPQ_HAS_PROMPT_OAUTH_DEVICE
1010

1111
#ifdef TRUFFLERUBY
1212
static VALUE auth_data_hook;

0 commit comments

Comments
 (0)