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

Commit81e8264

Browse files
committed
Declare AnonymousShmem pointer as "void *".
The original coding had it as "PGShmemHeader *", but that doesn't offer anynotational benefit because we don't dereference it. And it was resultingin compiler warnings on some platforms, notably buildfarm membercastoroides, where mmap() and munmap() are evidently declared to take andreturn "char *".
1 parent541ffa6 commit81e8264

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 longUsedShmemSegID=0;
6666
void*UsedShmemSegAddr=NULL;
6767
staticSizeAnonymousShmemSize;
68-
staticPGShmemHeader*AnonymousShmem;
68+
staticvoid*AnonymousShmem;
6969

7070
staticvoid*InternalIpcMemoryCreate(IpcMemoryKeymemKey,Sizesize);
7171
staticvoidIpcMemoryDetach(intstatus,Datumshmaddr);
@@ -382,7 +382,7 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
382382
PGShmemHeader*hdr;
383383
IpcMemoryIdshmid;
384384
structstatstatbuf;
385-
Sizeallocsize=size;
385+
Sizesysvsize=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
returnhdr;
542542
memcpy(AnonymousShmem,hdr,sizeof(PGShmemHeader));
543-
returnAnonymousShmem;
544-
543+
return (PGShmemHeader*)AnonymousShmem;
545544
}
546545

547546
#ifdefEXEC_BACKEND

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp