Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9341c78

Browse files
committed
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
1 parent 07b95c3 commit 9341c78

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

src/backend/lib/dshash.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include "storage/ipc.h"
3636
#include "storage/lwlock.h"
3737
#include "utils/dsa.h"
38-
#include "utils/hsearch.h"
38+
#include "utils/hashutils.h"
3939
#include "utils/memutils.h"
4040

4141
/*

src/backend/utils/hash/dynahash.c

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
#include "storage/shmem.h"
9090
#include "storage/spin.h"
9191
#include "utils/dynahash.h"
92+
#include "utils/hashutils.h"
9293
#include "utils/memutils.h"
9394

9495

src/include/utils/hashutils.h

+6
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ extern Datum hash_any_extended(const unsigned char *k,
2626
extern Datum hash_uint32(uint32 k);
2727
extern Datum hash_uint32_extended(uint32 k, uint64 seed);
2828

29+
extern uint32 string_hash(const void *key, Size keysize);
30+
extern uint32 tag_hash(const void *key, Size keysize);
31+
extern uint32 uint32_hash(const void *key, Size keysize);
32+
33+
#define oid_hash uint32_hash /* Remove me eventually */
34+
2935
/*
3036
* Combine two 32-bit hash values, resulting in another hash value, with
3137
* decent bit mixing.

src/include/utils/hsearch.h

+4-13
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ typedef struct
118118

119119
/*
120120
* prototypes for functions in dynahash.c
121+
*
122+
* Note: It is deprecated for callers of hash_create to explicitly specify
123+
* string_hash, tag_hash, uint32_hash, or oid_hash. Just set HASH_BLOBS or
124+
* not. Use HASH_FUNCTION only when you want something other than those.
121125
*/
122126
extern HTAB *hash_create(const char *tabname, long nelem,
123127
HASHCTL *info, int flags);
@@ -142,17 +146,4 @@ extern Size hash_get_shared_size(HASHCTL *info, int flags);
142146
extern void AtEOXact_HashTables(bool isCommit);
143147
extern void AtEOSubXact_HashTables(bool isCommit, int nestDepth);
144148

145-
/*
146-
* prototypes for functions in hashfn.c
147-
*
148-
* Note: It is deprecated for callers of hash_create to explicitly specify
149-
* string_hash, tag_hash, uint32_hash, or oid_hash. Just set HASH_BLOBS or
150-
* not. Use HASH_FUNCTION only when you want something other than those.
151-
*/
152-
extern uint32 string_hash(const void *key, Size keysize);
153-
extern uint32 tag_hash(const void *key, Size keysize);
154-
extern uint32 uint32_hash(const void *key, Size keysize);
155-
156-
#define oid_hash uint32_hash /* Remove me eventually */
157-
158149
#endif /* HSEARCH_H */

0 commit comments

Comments
 (0)