Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Move all inlined compatible wrappers into header file#57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletionMakefile
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
# contrib/pg_wait_sampling/Makefile

MODULE_big = pg_wait_sampling
OBJS = pg_wait_sampling.o collector.o compat.o
OBJS = pg_wait_sampling.o collector.o

EXTENSION = pg_wait_sampling
EXTVERSION = 1.1
Expand Down
1 change: 1 addition & 0 deletionscollector.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,7 @@
#include "utils/resowner.h"
#include "pgstat.h"

#include "compat.h"
#include "pg_wait_sampling.h"

static volatile sig_atomic_t shutdown_requested = false;
Expand Down
41 changes: 27 additions & 14 deletionscompat.c → compat.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,32 @@
/*
* compat.h
*Definitions for function wrappers compatible between PG versions.
*
* Copyright (c) 2015-2022, Postgres Professional
*
* IDENTIFICATION
* contrib/pg_wait_sampling/compat.h
*/
#ifndef __COMPAT_H__
#define __COMPAT_H__

#include "postgres.h"

#include "access/tupdesc.h"
#include "miscadmin.h"
#include "storage/shm_mq.h"

#include "pg_wait_sampling.h"
static inline TupleDesc
CreateTemplateTupleDescCompat(int nattrs, bool hasoid)
{
#if PG_VERSION_NUM >= 120000
return CreateTemplateTupleDesc(nattrs);
#else
return CreateTemplateTupleDesc(nattrs, hasoid);
#endif
}

inline void
staticinline void
shm_mq_detach_compat(shm_mq_handle *mqh, shm_mq *mq)
{
#if PG_VERSION_NUM >= 100000
Expand All@@ -15,7 +36,7 @@ shm_mq_detach_compat(shm_mq_handle *mqh, shm_mq *mq)
#endif
}

inline shm_mq_result
staticinline shm_mq_result
shm_mq_send_compat(shm_mq_handle *mqh, Size nbytes, const void *data,
bool nowait, bool force_flush)
{
Expand All@@ -26,17 +47,7 @@ shm_mq_send_compat(shm_mq_handle *mqh, Size nbytes, const void *data,
#endif
}

inline TupleDesc
CreateTemplateTupleDescCompat(int nattrs, bool hasoid)
{
#if PG_VERSION_NUM >= 120000
return CreateTemplateTupleDesc(nattrs);
#else
return CreateTemplateTupleDesc(nattrs, hasoid);
#endif
}

inline void
static inline void
InitPostgresCompat(const char *in_dbname, Oid dboid,
const char *username, Oid useroid,
bool load_session_libraries,
Expand All@@ -53,3 +64,5 @@ InitPostgresCompat(const char *in_dbname, Oid dboid,
InitPostgres(in_dbname, dboid, username, useroid, out_dbname);
#endif
}

#endif
1 change: 1 addition & 0 deletionspg_wait_sampling.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,6 +34,7 @@
#include "utils/memutils.h" /* TopMemoryContext. Actually for PG 9.6 only,
* but there should be no harm for others. */

#include "compat.h"
#include "pg_wait_sampling.h"

PG_MODULE_MAGIC;
Expand Down
11 changes: 0 additions & 11 deletionspg_wait_sampling.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -83,15 +83,4 @@ extern void register_wait_collector(void);
extern void alloc_history(History *, int);
extern PGDLLEXPORT void collector_main(Datum main_arg);

extern void shm_mq_detach_compat(shm_mq_handle *mqh, shm_mq *mq);
extern shm_mq_result shm_mq_send_compat(shm_mq_handle *mqh, Size nbytes,
const void *data, bool nowait,
bool force_flush);
extern TupleDesc CreateTemplateTupleDescCompat(int nattrs, bool hasoid);
extern void InitPostgresCompat(const char *in_dbname, Oid dboid,
const char *username, Oid useroid,
bool load_session_libraries,
bool override_allow_connections,
char *out_dbname);

#endif

[8]ページ先頭

©2009-2025 Movatter.jp