From 81e82643837de93909e0c5a8e14e805f3f69f41e Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 30 Jun 2012 17:19:46 -0400 Subject: [PATCH] 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 *". --- src/backend/port/sysv_shmem.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c index e040400bb1..98e049380a 100644 --- a/src/backend/port/sysv_shmem.c +++ b/src/backend/port/sysv_shmem.c @@ -65,7 +65,7 @@ typedef int IpcMemoryId; /* shared memory ID returned by shmget(2) */ unsigned long UsedShmemSegID = 0; void *UsedShmemSegAddr = NULL; static Size AnonymousShmemSize; -static PGShmemHeader *AnonymousShmem; +static void *AnonymousShmem; static void *InternalIpcMemoryCreate(IpcMemoryKey memKey, Size size); static void IpcMemoryDetach(int status, Datum shmaddr); @@ -382,7 +382,7 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port) PGShmemHeader *hdr; IpcMemoryId shmid; struct stat statbuf; - Size allocsize = size; + Size sysvsize = size; /* Room for a header? */ Assert(size > MAXALIGN(sizeof(PGShmemHeader))); @@ -440,7 +440,7 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port) AnonymousShmemSize = size; /* Now we need only allocate a minimal-sized SysV shmem block. */ - allocsize = sizeof(PGShmemHeader); + sysvsize = sizeof(PGShmemHeader); } #endif @@ -453,7 +453,7 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port) for (NextShmemSegID++;; NextShmemSegID++) { /* Try to create new segment */ - memAddress = InternalIpcMemoryCreate(NextShmemSegID, allocsize); + memAddress = InternalIpcMemoryCreate(NextShmemSegID, sysvsize); if (memAddress) break; /* successful create and attach */ @@ -492,7 +492,7 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port) /* * Now try again to create the segment. */ - memAddress = InternalIpcMemoryCreate(NextShmemSegID, allocsize); + memAddress = InternalIpcMemoryCreate(NextShmemSegID, sysvsize); if (memAddress) break; /* successful create and attach */ @@ -540,8 +540,7 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port) if (AnonymousShmem == NULL) return hdr; memcpy(AnonymousShmem, hdr, sizeof(PGShmemHeader)); - return AnonymousShmem; - + return (PGShmemHeader *) AnonymousShmem; } #ifdef EXEC_BACKEND