mirror of
https://github.com/postgres/postgres.git
synced 2025-11-19 13:42:17 +03:00
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 in shmem.h.' We can achieve the original goal with a struct forward declaration. (ipc.h was also not the correct header file.) Discussion: https://www.postgresql.org/message-id/flat/cnthxg2eekacrejyeonuhiaezc7vd7o2uowlsbenxqfkjwgvwj@qgzu6eoqrglb
This commit is contained in:
@@ -92,18 +92,13 @@ static HTAB *ShmemIndex = NULL; /* primary index hashtable for shmem */
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* InitShmemAccess() --- set up basic pointers to shared memory.
|
* InitShmemAccess() --- set up basic pointers to shared memory.
|
||||||
*
|
|
||||||
* Note: the argument should be declared "PGShmemHeader *seghdr",
|
|
||||||
* but we use void to avoid having to include ipc.h in shmem.h.
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
InitShmemAccess(void *seghdr)
|
InitShmemAccess(PGShmemHeader *seghdr)
|
||||||
{
|
{
|
||||||
PGShmemHeader *shmhdr = (PGShmemHeader *) seghdr;
|
ShmemSegHdr = seghdr;
|
||||||
|
ShmemBase = seghdr;
|
||||||
ShmemSegHdr = shmhdr;
|
ShmemEnd = (char *) ShmemBase + seghdr->totalsize;
|
||||||
ShmemBase = (void *) shmhdr;
|
|
||||||
ShmemEnd = (char *) ShmemBase + shmhdr->totalsize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -27,7 +27,8 @@
|
|||||||
|
|
||||||
/* shmem.c */
|
/* shmem.c */
|
||||||
extern PGDLLIMPORT slock_t *ShmemLock;
|
extern PGDLLIMPORT slock_t *ShmemLock;
|
||||||
extern void InitShmemAccess(void *seghdr);
|
struct PGShmemHeader; /* avoid including storage/pg_shmem.h here */
|
||||||
|
extern void InitShmemAccess(struct PGShmemHeader *seghdr);
|
||||||
extern void InitShmemAllocation(void);
|
extern void InitShmemAllocation(void);
|
||||||
extern void *ShmemAlloc(Size size);
|
extern void *ShmemAlloc(Size size);
|
||||||
extern void *ShmemAllocNoError(Size size);
|
extern void *ShmemAllocNoError(Size size);
|
||||||
|
|||||||
Reference in New Issue
Block a user