Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 81e8264

Browse files
committed
Declare AnonymousShmem pointer as "void *".
The original coding had it as "PGShmemHeader *", but that doesn't offer any notational benefit because we don't dereference it. And it was resulting in compiler warnings on some platforms, notably buildfarm member castoroides, where mmap() and munmap() are evidently declared to take and return "char *".
1 parent 541ffa6 commit 81e8264

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/backend/port/sysv_shmem.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ typedef int IpcMemoryId; /* shared memory ID returned by shmget(2) */
6565
unsigned long UsedShmemSegID = 0;
6666
void *UsedShmemSegAddr = NULL;
6767
static Size AnonymousShmemSize;
68-
static PGShmemHeader *AnonymousShmem;
68+
static void *AnonymousShmem;
6969

7070
static void *InternalIpcMemoryCreate(IpcMemoryKey memKey, Size size);
7171
static void IpcMemoryDetach(int status, Datum shmaddr);
@@ -382,7 +382,7 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
382382
PGShmemHeader *hdr;
383383
IpcMemoryId shmid;
384384
struct stat statbuf;
385-
Size allocsize = size;
385+
Size sysvsize = size;
386386

387387
/* Room for a header? */
388388
Assert(size > MAXALIGN(sizeof(PGShmemHeader)));
@@ -440,7 +440,7 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
440440
AnonymousShmemSize = size;
441441

442442
/* Now we need only allocate a minimal-sized SysV shmem block. */
443-
allocsize = sizeof(PGShmemHeader);
443+
sysvsize = sizeof(PGShmemHeader);
444444
}
445445
#endif
446446

@@ -453,7 +453,7 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
453453
for (NextShmemSegID++;; NextShmemSegID++)
454454
{
455455
/* Try to create new segment */
456-
memAddress = InternalIpcMemoryCreate(NextShmemSegID, allocsize);
456+
memAddress = InternalIpcMemoryCreate(NextShmemSegID, sysvsize);
457457
if (memAddress)
458458
break; /* successful create and attach */
459459

@@ -492,7 +492,7 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
492492
/*
493493
* Now try again to create the segment.
494494
*/
495-
memAddress = InternalIpcMemoryCreate(NextShmemSegID, allocsize);
495+
memAddress = InternalIpcMemoryCreate(NextShmemSegID, sysvsize);
496496
if (memAddress)
497497
break; /* successful create and attach */
498498

@@ -540,8 +540,7 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
540540
if (AnonymousShmem == NULL)
541541
return hdr;
542542
memcpy(AnonymousShmem, hdr, sizeof(PGShmemHeader));
543-
return AnonymousShmem;
544-
543+
return (PGShmemHeader *) AnonymousShmem;
545544
}
546545

547546
#ifdef EXEC_BACKEND

0 commit comments

Comments
 (0)