From 9ed3ee5001b6a2d4cb0166eb8f12a457f30aaca4 Mon Sep 17 00:00:00 2001 From: John Naylor Date: Sun, 21 Jan 2024 19:19:14 +0700 Subject: Simplify initialization of incremental hash state The standalone functions fasthash{32,64} use length for two purposes: how many bytes to hash, and how to perturb the internal seed. Developers using the incremental interface may not know the length ahead of time (e.g. for C strings). In this case, it's advised to pass length to the finalizer, but initialization still needed some length up front, in the form of a placeholder macro. Separate the concerns by having the standalone functions perturb the internal seed themselves from their own length parameter, allowing to remove "len" from fasthash_init(), as well as the placeholder macro. Discussion: https://postgr.es/m/CANWCAZbTUk2LOyhsFo33gjLyLAHZ7ucXCi5K9u%3D%2BPtnTShDKtw%40mail.gmail.com --- src/backend/catalog/namespace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/backend') diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c index b610aa62423..8df30b24401 100644 --- a/src/backend/catalog/namespace.c +++ b/src/backend/catalog/namespace.c @@ -256,7 +256,7 @@ spcachekey_hash(SearchPathCacheKey key) fasthash_state hs; int sp_len; - fasthash_init(&hs, FH_UNKNOWN_LENGTH, 0); + fasthash_init(&hs, 0); hs.accum = key.roleid; fasthash_combine(&hs); -- cgit v1.2.3