FreeBSD/contrib/subversion/subversion/libsvn_subr/cache-membuffer.c
/* Basically calculate a hash value for KEY of length KEY_LEN, combine it
 * with the CACHE->PREFIX and write the result in CACHE->COMBINED_KEY.
 * This could replace combine_key() entirely but we actually use it only
 * when the quick path failed.
 */
Basically calculate a hash value for KEY of length KEY_LEN, combine it
with the CACHE->PREFIX and write the result in CACHE->COMBINED_KEY.
This could replace combine_key() entirely but we actually use it only
when the quick path failed.
Basically calculate a hash value for KEY of length KEY_LEN combine it with the CACHE - > PREFIX and write the result in CACHE - > COMBINED_KEY . This could replace combine_key () entirely but we actually use it only when the quick path failed .
static void
combine_long_key(svn_membuffer_cache_t *cache,
                 const void *key,
                 apr_ssize_t key_len)
{
  apr_uint32_t *digest_buffer;
  char *key_copy;
  apr_size_t prefix_len = cache->prefix.entry_key.key_len;
  apr_size_t aligned_key_len;
  if (key_len == APR_HASH_KEY_STRING)
    key_len = strlen((const char *) key);
  aligned_key_len = ALIGN_VALUE(key_len);
  svn_membuf__ensure(&cache->combined_key.full_key,
                     aligned_key_len + prefix_len);
  key_copy = (char *)cache->combined_key.full_key.data + prefix_len;
  cache->combined_key.entry_key.key_len = aligned_key_len + prefix_len;
  memcpy(key_copy, key, key_len);
  memset(key_copy + key_len, 0, aligned_key_len - key_len);
  digest_buffer = (apr_uint32_t *)cache->combined_key.entry_key.fingerprint;
  svn__fnv1a_32x4_raw(digest_buffer, key, key_len);
  cache->combined_key.entry_key.fingerprint[0]
    ^= cache->prefix.entry_key.fingerprint[0];
  cache->combined_key.entry_key.fingerprint[1]
    ^= cache->prefix.entry_key.fingerprint[1];
}
static void combine_long_key ( svn_membuffer_cache_t * cache , const void * key , apr_ssize_t key_len ) { apr_uint32_t * digest_buffer ; char * key_copy ; apr_size_t prefix_len = cache -> prefix . entry_key . key_len ; apr_size_t aligned_key_len ; if ( key_len == APR_HASH_KEY_STRING ) key_len = strlen ( ( const char * ) key ) ; aligned_key_len = ALIGN_VALUE ( key_len ) ; svn_membuf__ensure ( & cache -> combined_key . full_key , aligned_key_len + prefix_len ) ; key_copy = ( char * ) cache -> combined_key . full_key . data + prefix_len ; cache -> combined_key . entry_key . key_len = aligned_key_len + prefix_len ; memcpy ( key_copy , key , key_len ) ; memset ( key_copy + key_len , 0 , aligned_key_len - key_len ) ; digest_buffer = ( apr_uint32_t * ) cache -> combined_key . entry_key . fingerprint ; svn__fnv1a_32x4_raw ( digest_buffer , key , key_len ) ; cache -> combined_key . entry_key . fingerprint [ 0 ] ^= cache -> prefix . entry_key . fingerprint [ 0 ] ; cache -> combined_key . entry_key . fingerprint [ 1 ] ^= cache -> prefix . entry_key . fingerprint [ 1 ] ; }
Basically calculate a hash value for KEY of length KEY_LEN, combine it
 with the CACHE->PREFIX and write the result in CACHE->COMBINED_KEY.
Basically calculate a hash value for KEY of length KEY_LEN combine it with the CACHE - > PREFIX and write the result in CACHE - > COMBINED_KEY .
/* handle variable-length keys */ /* Combine keys. */ /* Hash key into 16 bytes. */ /* Combine with prefix. */