From 5999e78fc45dcb91784b64b6e9ae43f4e4f68ca2 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 1 Oct 2001 05:36:17 +0000 Subject: Another round of cleanups for dynahash.c (maybe it's finally clean of portability issues). Caller-visible data structures are now allocated on MAXALIGN boundaries, allowing safe use of datatypes wider than 'long'. Rejigger hash_create API so that caller specifies size of key and total size of entry, not size of key and size of rest of entry. This simplifies life considerably since each number is just a sizeof(), and padding issues etc. are taken care of automatically. --- src/backend/storage/buffer/buf_init.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/backend/storage/buffer/buf_init.c') diff --git a/src/backend/storage/buffer/buf_init.c b/src/backend/storage/buffer/buf_init.c index 45a2e4aa160..322c45b0319 100644 --- a/src/backend/storage/buffer/buf_init.c +++ b/src/backend/storage/buffer/buf_init.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.44 2001/09/29 04:02:22 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.45 2001/10/01 05:36:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -280,9 +280,7 @@ BufferShmemSize(void) int size = 0; /* size of shmem index hash table */ - size += hash_estimate_size(SHMEM_INDEX_SIZE, - SHMEM_INDEX_KEYSIZE, - SHMEM_INDEX_DATASIZE); + size += hash_estimate_size(SHMEM_INDEX_SIZE, sizeof(ShmemIndexEnt)); /* size of buffer descriptors */ size += MAXALIGN((NBuffers + 1) * sizeof(BufferDesc)); @@ -291,9 +289,7 @@ BufferShmemSize(void) size += NBuffers * MAXALIGN(BLCKSZ); /* size of buffer hash table */ - size += hash_estimate_size(NBuffers, - sizeof(BufferTag), - sizeof(Buffer)); + size += hash_estimate_size(NBuffers, sizeof(BufferLookupEnt)); #ifdef BMTRACE size += (BMT_LIMIT * sizeof(bmtrace)) + sizeof(long); -- cgit v1.2.3