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

Commit72f0e96

Browse files
authored
Merge pull request#57 from arenadata/inline_compat_functions
Move all inlined compatible wrappers into header file
2 parents4c1ae7a +8ac2e6a commit72f0e96

File tree

5 files changed

+30
-26
lines changed

5 files changed

+30
-26
lines changed

‎Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# contrib/pg_wait_sampling/Makefile
22

33
MODULE_big = pg_wait_sampling
4-
OBJS = pg_wait_sampling.o collector.o compat.o
4+
OBJS = pg_wait_sampling.o collector.o
55

66
EXTENSION = pg_wait_sampling
77
EXTVERSION = 1.1

‎collector.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include"utils/resowner.h"
2727
#include"pgstat.h"
2828

29+
#include"compat.h"
2930
#include"pg_wait_sampling.h"
3031

3132
staticvolatilesig_atomic_tshutdown_requested= false;

‎compat.crenamed to‎compat.h

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,32 @@
1+
/*
2+
* compat.h
3+
*Definitions for function wrappers compatible between PG versions.
4+
*
5+
* Copyright (c) 2015-2022, Postgres Professional
6+
*
7+
* IDENTIFICATION
8+
* contrib/pg_wait_sampling/compat.h
9+
*/
10+
#ifndef__COMPAT_H__
11+
#define__COMPAT_H__
12+
113
#include"postgres.h"
214

315
#include"access/tupdesc.h"
416
#include"miscadmin.h"
17+
#include"storage/shm_mq.h"
518

6-
#include"pg_wait_sampling.h"
19+
staticinlineTupleDesc
20+
CreateTemplateTupleDescCompat(intnattrs,boolhasoid)
21+
{
22+
#ifPG_VERSION_NUM >=120000
23+
returnCreateTemplateTupleDesc(nattrs);
24+
#else
25+
returnCreateTemplateTupleDesc(nattrs,hasoid);
26+
#endif
27+
}
728

8-
inlinevoid
29+
staticinlinevoid
930
shm_mq_detach_compat(shm_mq_handle*mqh,shm_mq*mq)
1031
{
1132
#ifPG_VERSION_NUM >=100000
@@ -15,7 +36,7 @@ shm_mq_detach_compat(shm_mq_handle *mqh, shm_mq *mq)
1536
#endif
1637
}
1738

18-
inlineshm_mq_result
39+
staticinlineshm_mq_result
1940
shm_mq_send_compat(shm_mq_handle*mqh,Sizenbytes,constvoid*data,
2041
boolnowait,boolforce_flush)
2142
{
@@ -26,17 +47,7 @@ shm_mq_send_compat(shm_mq_handle *mqh, Size nbytes, const void *data,
2647
#endif
2748
}
2849

29-
inlineTupleDesc
30-
CreateTemplateTupleDescCompat(intnattrs,boolhasoid)
31-
{
32-
#ifPG_VERSION_NUM >=120000
33-
returnCreateTemplateTupleDesc(nattrs);
34-
#else
35-
returnCreateTemplateTupleDesc(nattrs,hasoid);
36-
#endif
37-
}
38-
39-
inlinevoid
50+
staticinlinevoid
4051
InitPostgresCompat(constchar*in_dbname,Oiddboid,
4152
constchar*username,Oiduseroid,
4253
boolload_session_libraries,
@@ -53,3 +64,5 @@ InitPostgresCompat(const char *in_dbname, Oid dboid,
5364
InitPostgres(in_dbname,dboid,username,useroid,out_dbname);
5465
#endif
5566
}
67+
68+
#endif

‎pg_wait_sampling.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include"utils/memutils.h"/* TopMemoryContext. Actually for PG 9.6 only,
3535
* but there should be no harm for others. */
3636

37+
#include"compat.h"
3738
#include"pg_wait_sampling.h"
3839

3940
PG_MODULE_MAGIC;

‎pg_wait_sampling.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,4 @@ extern void register_wait_collector(void);
8383
externvoidalloc_history(History*,int);
8484
externPGDLLEXPORTvoidcollector_main(Datummain_arg);
8585

86-
externvoidshm_mq_detach_compat(shm_mq_handle*mqh,shm_mq*mq);
87-
externshm_mq_resultshm_mq_send_compat(shm_mq_handle*mqh,Sizenbytes,
88-
constvoid*data,boolnowait,
89-
boolforce_flush);
90-
externTupleDescCreateTemplateTupleDescCompat(intnattrs,boolhasoid);
91-
externvoidInitPostgresCompat(constchar*in_dbname,Oiddboid,
92-
constchar*username,Oiduseroid,
93-
boolload_session_libraries,
94-
booloverride_allow_connections,
95-
char*out_dbname);
96-
9786
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp