summaryrefslogtreecommitdiff
path: root/src/backend/storage/ipc/shmem.c
diff options
context:
space:
mode:
authorTom Lane2001-10-05 17:28:13 +0000
committerTom Lane2001-10-05 17:28:13 +0000
commit8a52b893b3d83c6dc796fae6a07a4ac30c871fc4 (patch)
tree65b88475931f536afffe13f489c10167a8b12a12 /src/backend/storage/ipc/shmem.c
parent343318028fb4aca0c69663c7d429d602a32aaf02 (diff)
Further cleanup of dynahash.c API, in pursuit of portability and
readability. Bizarre '(long *) TRUE' return convention is gone, in favor of just raising an error internally in dynahash.c when we detect hashtable corruption. HashTableWalk is gone, in favor of using hash_seq_search directly, since it had no hope of working with non-LONGALIGNable datatypes. Simplify some other code that was made undesirably grotty by promixity to HashTableWalk.
Diffstat (limited to 'src/backend/storage/ipc/shmem.c')
-rw-r--r--src/backend/storage/ipc/shmem.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c
index 024db5bd533..32f2cf98a1d 100644
--- a/src/backend/storage/ipc/shmem.c
+++ b/src/backend/storage/ipc/shmem.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.60 2001/10/01 05:36:14 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.61 2001/10/05 17:28:12 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -210,7 +210,7 @@ InitShmemIndex(void)
result = (ShmemIndexEnt *)
hash_search(ShmemIndex, (void *) &item, HASH_ENTER, &found);
if (!result)
- elog(FATAL, "InitShmemIndex: corrupted shmem index");
+ elog(FATAL, "InitShmemIndex: Shmem Index out of memory");
Assert(ShmemBootstrap && !found);
@@ -234,7 +234,7 @@ InitShmemIndex(void)
* table at once.
*/
HTAB *
-ShmemInitHash(char *name, /* table string name for shmem index */
+ShmemInitHash(const char *name, /* table string name for shmem index */
long init_size, /* initial table size */
long max_size, /* max size of the table */
HASHCTL *infoP, /* info about key and bucket size */
@@ -277,7 +277,7 @@ ShmemInitHash(char *name, /* table string name for shmem index */
infoP->hctl = (HASHHDR *) location;
infoP->dir = (HASHSEGMENT *) (((char *) location) + sizeof(HASHHDR));
- return hash_create(init_size, infoP, hash_flags);
+ return hash_create(name, init_size, infoP, hash_flags);
}
/*
@@ -295,7 +295,7 @@ ShmemInitHash(char *name, /* table string name for shmem index */
* initialized).
*/
void *
-ShmemInitStruct(char *name, Size size, bool *foundPtr)
+ShmemInitStruct(const char *name, Size size, bool *foundPtr)
{
ShmemIndexEnt *result,
item;
@@ -328,7 +328,7 @@ ShmemInitStruct(char *name, Size size, bool *foundPtr)
if (!result)
{
LWLockRelease(ShmemIndexLock);
- elog(ERROR, "ShmemInitStruct: Shmem Index corrupted");
+ elog(ERROR, "ShmemInitStruct: Shmem Index out of memory");
return NULL;
}
@@ -357,12 +357,12 @@ ShmemInitStruct(char *name, Size size, bool *foundPtr)
{
/* out of memory */
Assert(ShmemIndex);
- hash_search(ShmemIndex, (void *) &item, HASH_REMOVE, foundPtr);
+ hash_search(ShmemIndex, (void *) &item, HASH_REMOVE, NULL);
LWLockRelease(ShmemIndexLock);
- *foundPtr = FALSE;
elog(NOTICE, "ShmemInitStruct: cannot allocate '%s'",
name);
+ *foundPtr = FALSE;
return NULL;
}
result->size = size;