Put all the prototypes for hashfn.c into the same header file.
authorRobert Haas <rhaas@postgresql.org>
Mon, 24 Feb 2020 11:52:45 +0000 (17:22 +0530)
committerRobert Haas <rhaas@postgresql.org>
Mon, 24 Feb 2020 11:52:45 +0000 (17:22 +0530)
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

src/backend/lib/dshash.c
src/backend/utils/hash/dynahash.c
src/include/utils/hashutils.h
src/include/utils/hsearch.h

index fbdd9413256800b54d51bc514488c58192bcf224..5e0167d9b0801ae4ad2e2f08c95b91470fa8c36a 100644 (file)
@@ -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"
 
 /*
index c9026f0e1a8364ad9b4f2f155fc420fc5b398c63..d245e1aa12ceeb8e7cea732b69fc2a3d00c861ff 100644 (file)
@@ -89,6 +89,7 @@
 #include "storage/shmem.h"
 #include "storage/spin.h"
 #include "utils/dynahash.h"
+#include "utils/hashutils.h"
 #include "utils/memutils.h"
 
 
index 9a2e13f536e30e113481e2e3ff1078a966e22bb0..f2ae55194aec26c411c7b3ab486aa12fc8db48ea 100644 (file)
@@ -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.
index 934c4a399e9d40ad0aac56e25017044a1e9a4bb7..f1deb9beab0458db9c0557c23edb9916226f7d27 100644 (file)
@@ -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 */