mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
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.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/freespace/freespace.c,v 1.6 2001/10/01 05:36:14 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/freespace/freespace.c,v 1.7 2001/10/05 17:28:12 tgl Exp $
|
||||
*
|
||||
*
|
||||
* NOTES:
|
||||
@@ -490,16 +490,12 @@ static FSMRelation *
|
||||
lookup_fsm_rel(RelFileNode *rel)
|
||||
{
|
||||
FSMRelation *fsmrel;
|
||||
bool found;
|
||||
|
||||
fsmrel = (FSMRelation *) hash_search(FreeSpaceMap->relHash,
|
||||
(void *) rel,
|
||||
HASH_FIND,
|
||||
&found);
|
||||
NULL);
|
||||
if (!fsmrel)
|
||||
elog(ERROR, "FreeSpaceMap hashtable corrupted");
|
||||
|
||||
if (!found)
|
||||
return NULL;
|
||||
|
||||
return fsmrel;
|
||||
@@ -523,7 +519,7 @@ create_fsm_rel(RelFileNode *rel)
|
||||
HASH_ENTER,
|
||||
&found);
|
||||
if (!fsmrel)
|
||||
elog(ERROR, "FreeSpaceMap hashtable corrupted");
|
||||
elog(ERROR, "FreeSpaceMap hashtable out of memory");
|
||||
|
||||
if (!found)
|
||||
{
|
||||
@@ -584,7 +580,6 @@ static void
|
||||
delete_fsm_rel(FSMRelation *fsmrel)
|
||||
{
|
||||
FSMRelation *result;
|
||||
bool found;
|
||||
|
||||
free_chunk_chain(fsmrel->relChunks);
|
||||
unlink_fsm_rel(fsmrel);
|
||||
@@ -592,8 +587,8 @@ delete_fsm_rel(FSMRelation *fsmrel)
|
||||
result = (FSMRelation *) hash_search(FreeSpaceMap->relHash,
|
||||
(void *) &(fsmrel->key),
|
||||
HASH_REMOVE,
|
||||
&found);
|
||||
if (!result || !found)
|
||||
NULL);
|
||||
if (!result)
|
||||
elog(ERROR, "FreeSpaceMap hashtable corrupted");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user