2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

Add tests for hash function, and comment dns_rbt_addnode() (#41179)

No CHANGES entry necessary.
This commit is contained in:
Mukund Sivaraman
2016-02-08 14:51:53 +05:30
parent 0c29904b27
commit 614ce1b65f
3 changed files with 154 additions and 16 deletions

View File

@@ -428,10 +428,14 @@ isc_hash_function(const void *data, size_t length,
const unsigned char *bp;
const unsigned char *be;
INSIST(data == NULL || length > 0);
RUNTIME_CHECK(isc_once_do(&fnv_once, fnv_initialize) == ISC_R_SUCCESS);
hval = previous_hashp != NULL ? *previous_hashp : fnv_offset_basis;
if (length == 0)
return (hval);
bp = (const unsigned char *) data;
be = bp + length;
@@ -490,10 +494,14 @@ isc_hash_function_reverse(const void *data, size_t length,
const unsigned char *bp;
const unsigned char *be;
INSIST(data == NULL || length > 0);
RUNTIME_CHECK(isc_once_do(&fnv_once, fnv_initialize) == ISC_R_SUCCESS);
hval = ISC_UNLIKELY(previous_hashp != NULL) ? *previous_hashp : fnv_offset_basis;
if (length == 0)
return (hval);
bp = (const unsigned char *) data;
be = bp + length;