v2-0002-Put-all-the-prototypes-for-hashfn.c-into-the-same.patch
application/octet-stream
Filename: v2-0002-Put-all-the-prototypes-for-hashfn.c-into-the-same.patch
Type: application/octet-stream
Part: 1
Patch
Format: format-patch
Series: patch v2-0002
Subject: Put all the prototypes for hashfn.c into the same header file.
| File | + | − |
|---|---|---|
| src/backend/lib/dshash.c | 1 | 1 |
| src/backend/utils/hash/dynahash.c | 1 | 0 |
| src/include/utils/hashutils.h | 6 | 0 |
| src/include/utils/hsearch.h | 4 | 13 |
From 7f1c70b5c9cb2cbb4a52f8b87d3ddf6300d1d08a Mon Sep 17 00:00:00 2001 From: Robert Haas <rhaas@postgresql.org> Date: Fri, 7 Feb 2020 11:04:30 -0500 Subject: [PATCH v2 2/4] 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. --- src/backend/lib/dshash.c | 2 +- src/backend/utils/hash/dynahash.c | 1 + src/include/utils/hashutils.h | 6 ++++++ src/include/utils/hsearch.h | 17 ++++------------- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/backend/lib/dshash.c b/src/backend/lib/dshash.c index fbdd941325..5e0167d9b0 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 c9026f0e1a..d245e1aa12 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 9a2e13f536..f2ae55194a 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 934c4a399e..f1deb9beab 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 */ -- 2.21.1 (Apple Git-122.3)