aboutsummaryrefslogtreecommitdiff
path: root/src/backend/lib
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-10-05 17:28:13 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-10-05 17:28:13 +0000
commit8a52b893b3d83c6dc796fae6a07a4ac30c871fc4 (patch)
tree65b88475931f536afffe13f489c10167a8b12a12 /src/backend/lib
parent343318028fb4aca0c69663c7d429d602a32aaf02 (diff)
downloadpostgresql-8a52b893b3d83c6dc796fae6a07a4ac30c871fc4.tar.gz
postgresql-8a52b893b3d83c6dc796fae6a07a4ac30c871fc4.zip
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/lib')
-rw-r--r--src/backend/lib/Makefile4
-rw-r--r--src/backend/lib/hasht.c58
2 files changed, 2 insertions, 60 deletions
diff --git a/src/backend/lib/Makefile b/src/backend/lib/Makefile
index ed190d6d2b4..58e47f67144 100644
--- a/src/backend/lib/Makefile
+++ b/src/backend/lib/Makefile
@@ -4,7 +4,7 @@
# Makefile for lib (miscellaneous stuff)
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/backend/lib/Makefile,v 1.15 2000/08/31 16:09:59 petere Exp $
+# $Header: /cvsroot/pgsql/src/backend/lib/Makefile,v 1.16 2001/10/05 17:28:12 tgl Exp $
#
#-------------------------------------------------------------------------
@@ -12,7 +12,7 @@ subdir = src/backend/lib
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
-OBJS = bit.o hasht.o lispsort.o stringinfo.o dllist.o
+OBJS = bit.o dllist.o lispsort.o stringinfo.o
all: SUBSYS.o
diff --git a/src/backend/lib/hasht.c b/src/backend/lib/hasht.c
deleted file mode 100644
index 5825a39cc5e..00000000000
--- a/src/backend/lib/hasht.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * hasht.c
- * hash table related functions that are not directly supported
- * by the hashing packages under utils/hash.
- *
- * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- *
- * IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/lib/Attic/hasht.c,v 1.15 2001/01/24 19:42:55 momjian Exp $
- *
- *-------------------------------------------------------------------------
- */
-#include "postgres.h"
-
-#include "lib/hasht.h"
-#include "utils/memutils.h"
-
-/* -----------------------------------
- * HashTableWalk
- *
- * call given function on every element in hashtable
- *
- * one extra argument (arg) may be supplied
- *
- * NOTE: it is allowed for the given function to delete the hashtable entry
- * it is passed. However, deleting any other element while the scan is
- * in progress is UNDEFINED (see hash_seq functions). Also, if elements are
- * added to the table while the scan is in progress, it is unspecified
- * whether they will be visited by the scan or not.
- * -----------------------------------
- */
-void
-HashTableWalk(HTAB *hashtable, HashtFunc function, Datum arg)
-{
- HASH_SEQ_STATUS status;
- long *hashent;
- void *data;
- int keysize;
-
- hash_seq_init(&status, hashtable);
- keysize = hashtable->hctl->keysize;
-
- while ((hashent = hash_seq_search(&status)) != (long *) TRUE)
- {
- if (hashent == NULL)
- elog(FATAL, "error in HashTableWalk");
-
- /*
- * XXX the corresponding hash table insertion does NOT LONGALIGN
- * -- make sure the keysize is ok
- */
- data = (void *) LONGALIGN((char *) hashent + keysize);
- (*function) (data, arg);
- }
-}