aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2020-02-24 17:22:45 +0530
committerRobert Haas <rhaas@postgresql.org>2020-02-24 17:22:45 +0530
commit9341c783cc42ffae5860c86bdc713bd47d734ffd (patch)
tree5bf0e9fd3a04a442d222a91919ba1df48dd90790 /src
parent07b95c3d8334f737d4717c91967729f7721e785c (diff)
downloadpostgresql-9341c783cc42ffae5860c86bdc713bd47d734ffd.tar.gz
postgresql-9341c783cc42ffae5860c86bdc713bd47d734ffd.zip
Put all the prototypes for hashfn.c into the same header file.
Previously, some of the prototypes for functions in hashfn.c were in utils/hashutils.h and others were in utils/hsearch.h, but that is confusing and has no particular benefit. Patch by me, reviewed by Suraj Kharage and Mark Dilger. Discussion: http://postgr.es/m/CA+TgmoaRiG4TXND8QuM6JXFRkM_1wL2ZNhzaUKsuec9-4yrkgw@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r--src/backend/lib/dshash.c2
-rw-r--r--src/backend/utils/hash/dynahash.c1
-rw-r--r--src/include/utils/hashutils.h6
-rw-r--r--src/include/utils/hsearch.h17
4 files changed, 12 insertions, 14 deletions
diff --git a/src/backend/lib/dshash.c b/src/backend/lib/dshash.c
index fbdd9413256..5e0167d9b08 100644
--- a/src/backend/lib/dshash.c
+++ b/src/backend/lib/dshash.c
@@ -35,7 +35,7 @@
#include "storage/ipc.h"
#include "storage/lwlock.h"
#include "utils/dsa.h"
-#include "utils/hsearch.h"
+#include "utils/hashutils.h"
#include "utils/memutils.h"
/*
diff --git a/src/backend/utils/hash/dynahash.c b/src/backend/utils/hash/dynahash.c
index c9026f0e1a8..d245e1aa12c 100644
--- a/src/backend/utils/hash/dynahash.c
+++ b/src/backend/utils/hash/dynahash.c
@@ -89,6 +89,7 @@
#include "storage/shmem.h"
#include "storage/spin.h"
#include "utils/dynahash.h"
+#include "utils/hashutils.h"
#include "utils/memutils.h"
diff --git a/src/include/utils/hashutils.h b/src/include/utils/hashutils.h
index 9a2e13f536e..f2ae55194ae 100644
--- a/src/include/utils/hashutils.h
+++ b/src/include/utils/hashutils.h
@@ -26,6 +26,12 @@ extern Datum hash_any_extended(const unsigned char *k,
extern Datum hash_uint32(uint32 k);
extern Datum hash_uint32_extended(uint32 k, uint64 seed);
+extern uint32 string_hash(const void *key, Size keysize);
+extern uint32 tag_hash(const void *key, Size keysize);
+extern uint32 uint32_hash(const void *key, Size keysize);
+
+#define oid_hash uint32_hash /* Remove me eventually */
+
/*
* Combine two 32-bit hash values, resulting in another hash value, with
* decent bit mixing.
diff --git a/src/include/utils/hsearch.h b/src/include/utils/hsearch.h
index 934c4a399e9..f1deb9beab0 100644
--- a/src/include/utils/hsearch.h
+++ b/src/include/utils/hsearch.h
@@ -118,6 +118,10 @@ typedef struct
/*
* prototypes for functions in dynahash.c
+ *
+ * Note: It is deprecated for callers of hash_create to explicitly specify
+ * string_hash, tag_hash, uint32_hash, or oid_hash. Just set HASH_BLOBS or
+ * not. Use HASH_FUNCTION only when you want something other than those.
*/
extern HTAB *hash_create(const char *tabname, long nelem,
HASHCTL *info, int flags);
@@ -142,17 +146,4 @@ extern Size hash_get_shared_size(HASHCTL *info, int flags);
extern void AtEOXact_HashTables(bool isCommit);
extern void AtEOSubXact_HashTables(bool isCommit, int nestDepth);
-/*
- * prototypes for functions in hashfn.c
- *
- * Note: It is deprecated for callers of hash_create to explicitly specify
- * string_hash, tag_hash, uint32_hash, or oid_hash. Just set HASH_BLOBS or
- * not. Use HASH_FUNCTION only when you want something other than those.
- */
-extern uint32 string_hash(const void *key, Size keysize);
-extern uint32 tag_hash(const void *key, Size keysize);
-extern uint32 uint32_hash(const void *key, Size keysize);
-
-#define oid_hash uint32_hash /* Remove me eventually */
-
#endif /* HSEARCH_H */