Skip to content

Commit 5b1c607

Browse files
author
Neil Conway
committed
Remove an unused variable `ShmemBootstrap', and remove an obsolete
comment. Patch from Alvaro.
1 parent 280de29 commit 5b1c607

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

src/backend/storage/ipc/shmem.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/storage/ipc/shmem.c,v 1.82 2004/12/31 22:00:56 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/backend/storage/ipc/shmem.c,v 1.83 2005/04/04 04:34:41 neilc Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -53,9 +53,6 @@
5353
* cannot be redistributed to other tables. We could build a simple
5454
* hash bucket garbage collector if need be. Right now, it seems
5555
* unnecessary.
56-
*
57-
* See InitSem() in sem.c for an example of how to use the
58-
* shmem index.
5956
*/
6057

6158
#include "postgres.h"
@@ -85,8 +82,6 @@ NON_EXEC_STATIC void *ShmemIndexAlloc = NULL; /* Memory actually
8582

8683
static HTAB *ShmemIndex = NULL; /* primary index hashtable for shmem */
8784

88-
static bool ShmemBootstrap = false; /* bootstrapping shmem index? */
89-
9085

9186
/*
9287
* InitShmemAllocation() --- set up shared-memory allocation.
@@ -213,10 +208,10 @@ InitShmemIndex(void)
213208
/*
214209
* Since ShmemInitHash calls ShmemInitStruct, which expects the
215210
* ShmemIndex hashtable to exist already, we have a bit of a
216-
* circularity problem in initializing the ShmemIndex itself. We set
217-
* ShmemBootstrap to tell ShmemInitStruct to fake it.
211+
* circularity problem in initializing the ShmemIndex itself. The
212+
* special "ShmemIndex" hash table name will tell ShmemInitStruct
213+
* to fake it.
218214
*/
219-
ShmemBootstrap = true;
220215

221216
/* create the shared memory shmem index */
222217
info.keysize = SHMEM_INDEX_KEYSIZE;
@@ -245,12 +240,11 @@ InitShmemIndex(void)
245240
(errcode(ERRCODE_OUT_OF_MEMORY),
246241
errmsg("out of shared memory")));
247242

248-
Assert(ShmemBootstrap && !found);
243+
Assert(!found);
249244

250245
result->location = MAKE_OFFSET(ShmemIndex->hctl);
251246
result->size = SHMEM_INDEX_SIZE;
252247

253-
ShmemBootstrap = false;
254248
}
255249

256250
/* now release the lock acquired in ShmemInitStruct */
@@ -349,11 +343,10 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
349343

350344
if (!ShmemIndex)
351345
{
346+
Assert(strcmp(name, "ShmemIndex") == 0);
352347
if (IsUnderPostmaster)
353348
{
354349
/* Must be initializing a (non-standalone) backend */
355-
Assert(strcmp(name, "ShmemIndex") == 0);
356-
Assert(ShmemBootstrap);
357350
Assert(ShmemIndexAlloc);
358351
*foundPtr = TRUE;
359352
}
@@ -366,8 +359,6 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
366359
* Notice that the ShmemIndexLock is held until the shmem index
367360
* has been completely initialized.
368361
*/
369-
Assert(strcmp(name, "ShmemIndex") == 0);
370-
Assert(ShmemBootstrap);
371362
*foundPtr = FALSE;
372363
ShmemIndexAlloc = ShmemAlloc(size);
373364
}

0 commit comments

Comments
 (0)