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

Commitbe05cc6

Browse files
author
Maksim Milyutin
committed
Move all inlined compatible wrappers into header file
Current implementation segregated compatible inline function wrappersinto separate .c file that prevented inlining of these functions intocaller points in other modules. In current patch all these fuctions aremoved to header file compat.h so that inlining works.Resolve#45
1 parent9dad24b commitbe05cc6

File tree

5 files changed

+27
-23
lines changed

5 files changed

+27
-23
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: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,30 @@
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+
inlineTupleDesc
20+
CreateTemplateTupleDescCompat(intnattrs,boolhasoid)
21+
{
22+
#ifPG_VERSION_NUM >=120000
23+
returnCreateTemplateTupleDesc(nattrs);
24+
#else
25+
returnCreateTemplateTupleDesc(nattrs,hasoid);
26+
#endif
27+
}
728

829
inlinevoid
930
shm_mq_detach_compat(shm_mq_handle*mqh,shm_mq*mq)
@@ -26,16 +47,6 @@ 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-
3950
inlinevoid
4051
InitPostgresCompat(constchar*in_dbname,Oiddboid,
4152
constchar*username,Oiduseroid,
@@ -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