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/access/transam/xlogutils.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/backend/access/transam/xlogutils.c') diff --git a/src/backend/access/transam/xlogutils.c b/src/backend/access/transam/xlogutils.c index 4cae914cf41..8bd55026d42 100644 --- a/src/backend/access/transam/xlogutils.c +++ b/src/backend/access/transam/xlogutils.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/backend/access/transam/xlogutils.c,v 1.18 2001/08/25 18:52:41 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/xlogutils.c,v 1.19 2001/10/01 05:36:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -228,9 +228,9 @@ _xl_init_rel_cache(void) _xlrelarr[0].moreRecently = &(_xlrelarr[0]); _xlrelarr[0].lessRecently = &(_xlrelarr[0]); - memset(&ctl, 0, (int) sizeof(ctl)); + memset(&ctl, 0, sizeof(ctl)); ctl.keysize = sizeof(RelFileNode); - ctl.datasize = sizeof(XLogRelDesc *); + ctl.entrysize = sizeof(XLogRelCacheEntry); ctl.hash = tag_hash; _xlrelcache = hash_create(_XLOG_RELCACHESIZE, &ctl, @@ -249,7 +249,7 @@ _xl_remove_hash_entry(XLogRelDesc **edata, Datum dummy) rdesc->moreRecently->lessRecently = rdesc->lessRecently; hentry = (XLogRelCacheEntry *) hash_search(_xlrelcache, - (char *) &(rdesc->reldata.rd_node), HASH_REMOVE, &found); + (void *) &(rdesc->reldata.rd_node), HASH_REMOVE, &found); if (hentry == NULL) elog(STOP, "_xl_remove_hash_entry: can't delete from cache"); @@ -321,7 +321,7 @@ XLogOpenRelation(bool redo, RmgrId rmid, RelFileNode rnode) bool found; hentry = (XLogRelCacheEntry *) - hash_search(_xlrelcache, (char *) &rnode, HASH_FIND, &found); + hash_search(_xlrelcache, (void *) &rnode, HASH_FIND, &found); if (hentry == NULL) elog(STOP, "XLogOpenRelation: error in cache"); @@ -345,7 +345,7 @@ XLogOpenRelation(bool redo, RmgrId rmid, RelFileNode rnode) res->reldata.rd_node = rnode; hentry = (XLogRelCacheEntry *) - hash_search(_xlrelcache, (char *) &rnode, HASH_ENTER, &found); + hash_search(_xlrelcache, (void *) &rnode, HASH_ENTER, &found); if (hentry == NULL) elog(STOP, "XLogOpenRelation: can't insert into cache"); -- cgit v1.2.3