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

Commit2a7b2d9

Browse files
committed
Improve InitShmemAccess() prototype
The code comment said, 'the argument should be declared "PGShmemHeader*seghdr", but we use void to avoid having to include ipc.h inshmem.h.' We can achieve the original goal with a struct forwarddeclaration. (ipc.h was also not the correct header file.)Discussion:https://www.postgresql.org/message-id/flat/cnthxg2eekacrejyeonuhiaezc7vd7o2uowlsbenxqfkjwgvwj@qgzu6eoqrglb
1 parente15e567 commit2a7b2d9

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

‎src/backend/storage/ipc/shmem.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,13 @@ static HTAB *ShmemIndex = NULL; /* primary index hashtable for shmem */
9292

9393
/*
9494
*InitShmemAccess() --- set up basic pointers to shared memory.
95-
*
96-
* Note: the argument should be declared "PGShmemHeader *seghdr",
97-
* but we use void to avoid having to include ipc.h in shmem.h.
9895
*/
9996
void
100-
InitShmemAccess(void*seghdr)
97+
InitShmemAccess(PGShmemHeader*seghdr)
10198
{
102-
PGShmemHeader*shmhdr= (PGShmemHeader*)seghdr;
103-
104-
ShmemSegHdr=shmhdr;
105-
ShmemBase= (void*)shmhdr;
106-
ShmemEnd= (char*)ShmemBase+shmhdr->totalsize;
99+
ShmemSegHdr=seghdr;
100+
ShmemBase=seghdr;
101+
ShmemEnd= (char*)ShmemBase+seghdr->totalsize;
107102
}
108103

109104
/*

‎src/include/storage/shmem.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727

2828
/* shmem.c */
2929
externPGDLLIMPORTslock_t*ShmemLock;
30-
externvoidInitShmemAccess(void*seghdr);
30+
structPGShmemHeader;/* avoid including storage/pg_shmem.h here */
31+
externvoidInitShmemAccess(structPGShmemHeader*seghdr);
3132
externvoidInitShmemAllocation(void);
3233
externvoid*ShmemAlloc(Sizesize);
3334
externvoid*ShmemAllocNoError(Sizesize);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp