summaryrefslogtreecommitdiff
path: root/src/include
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/include
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/include')
-rw-r--r--src/include/lib/hasht.h24
-rw-r--r--src/include/storage/shmem.h6
-rw-r--r--src/include/utils/hsearch.h13
-rw-r--r--src/include/utils/portal.h4
4 files changed, 13 insertions, 34 deletions
diff --git a/src/include/lib/hasht.h b/src/include/lib/hasht.h
deleted file mode 100644
index 34aa89c617..0000000000
--- a/src/include/lib/hasht.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * hasht.h
- * hash table related functions that are not directly supported
- * under utils/hash.
- *
- *
- * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * $Id: hasht.h,v 1.12 2001/01/24 19:43:24 momjian Exp $
- *
- *-------------------------------------------------------------------------
- */
-#ifndef HASHT_H
-#define HASHT_H
-
-#include "utils/hsearch.h"
-
-typedef void (*HashtFunc) (void *hashitem, Datum arg);
-
-extern void HashTableWalk(HTAB *hashtable, HashtFunc function, Datum arg);
-
-#endif /* HASHT_H */
diff --git a/src/include/storage/shmem.h b/src/include/storage/shmem.h
index a7ca140382..b41cc2aa0d 100644
--- a/src/include/storage/shmem.h
+++ b/src/include/storage/shmem.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: shmem.h,v 1.32 2001/10/01 05:36:17 tgl Exp $
+ * $Id: shmem.h,v 1.33 2001/10/05 17:28:13 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -66,9 +66,9 @@ extern void InitShmemAllocation(void *seghdr);
extern void *ShmemAlloc(Size size);
extern bool ShmemIsValid(unsigned long addr);
extern void InitShmemIndex(void);
-extern HTAB *ShmemInitHash(char *name, long init_size, long max_size,
+extern HTAB *ShmemInitHash(const char *name, long init_size, long max_size,
HASHCTL *infoP, int hash_flags);
-extern void *ShmemInitStruct(char *name, Size size, bool *foundPtr);
+extern void *ShmemInitStruct(const char *name, Size size, bool *foundPtr);
/* size constants for the shmem index table */
diff --git a/src/include/utils/hsearch.h b/src/include/utils/hsearch.h
index 5b65e3ee23..79f3296f12 100644
--- a/src/include/utils/hsearch.h
+++ b/src/include/utils/hsearch.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: hsearch.h,v 1.21 2001/10/01 05:36:17 tgl Exp $
+ * $Id: hsearch.h,v 1.22 2001/10/05 17:28:13 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,7 +42,7 @@
/*
* HASHELEMENT is the private part of a hashtable entry. The caller's data
* follows the HASHELEMENT structure (on a MAXALIGN'd boundary). The hash key
- * is expected to be at the start of the caller's hash entry structure.
+ * is expected to be at the start of the caller's hash entry data structure.
*/
typedef struct HASHELEMENT
{
@@ -85,10 +85,12 @@ typedef struct HASHHDR
typedef struct HTAB
{
HASHHDR *hctl; /* shared control information */
- long (*hash) (void *key, int keysize); /* Hash Function */
HASHSEGMENT *dir; /* directory of segment starts */
+ long (*hash) (void *key, int keysize); /* Hash Function */
void *(*alloc) (Size);/* memory allocator */
MemoryContext hcxt; /* memory context if default allocator used */
+ char *tabname; /* table name (for error messages) */
+ bool isshared; /* true if table is in shared memory */
} HTAB;
/* Parameter data structure for hash_create */
@@ -147,9 +149,10 @@ typedef struct
/*
* prototypes for functions in dynahash.c
*/
-extern HTAB *hash_create(long nelem, HASHCTL *info, int flags);
+extern HTAB *hash_create(const char *tabname, long nelem,
+ HASHCTL *info, int flags);
extern void hash_destroy(HTAB *hashp);
-extern void hash_stats(char *where, HTAB *hashp);
+extern void hash_stats(const char *where, HTAB *hashp);
extern void *hash_search(HTAB *hashp, void *keyPtr, HASHACTION action,
bool *foundPtr);
extern void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp);
diff --git a/src/include/utils/portal.h b/src/include/utils/portal.h
index 6a17ec8670..df3581c653 100644
--- a/src/include/utils/portal.h
+++ b/src/include/utils/portal.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: portal.h,v 1.28 2001/05/21 14:22:18 wieck Exp $
+ * $Id: portal.h,v 1.29 2001/10/05 17:28:13 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -61,7 +61,7 @@ typedef struct PortalData
extern void EnablePortalManager(void);
extern void AtEOXact_portals(void);
extern Portal CreatePortal(char *name);
-extern void PortalDrop(Portal *portalP);
+extern void PortalDrop(Portal portal);
extern Portal GetPortalByName(char *name);
extern void PortalSetQuery(Portal portal, QueryDesc *queryDesc,
TupleDesc attinfo, EState *state,