librnr/hash.c
bool_t hash_table_verify(hash_t *hash)
{
  hashcount_t count = 0;
  hash_val_t chain;
  hnode_t **npp;

  // Step 1
  if (hash->dynamic)
  {
    CHKEXPR_ULONG(hash->lowmark, (hash->lowmark < hash->highmark), false);
    CHKEXPR_ULONG(hash->lowmark, is_power_of_two(hash->lowmark), false);
    CHKEXPR_ULONG(hash->highmark, is_power_of_two(hash->highmark), false);
  }

  // Step 2
  for(chain = 0; chain < hash->nchains; chain++)
  {
    for(npp = hash->table + chain; *npp; npp = &(*npp)->next)
    {
      CHKEXPR_PTR(npp, ((*npp)->pself == npp), false);
      CHKEXPR_PTR(npp, (((*npp)->hkey & hash->mask) == chain), false);
      count++;
    }
  }

  CHKEXPR_ULONG(hash->count, (hash->count == count), false);

  return true;
}
/*!
 * \brief Verify hash table consistency.
 * 
 * If \ref hash_self_verify enabled (see \ref hash_set_self_verify()), this
 * call is automatically called during hash table modification operations.
 *
 * \par Notes &amp; Steps:
 * \b 1.
 *    If the hash table is dynamic, verify whether the high and
 *    low expansion/shrinkage thresholds are powers of two.
 * \b 2.
 *    For each chain, verify whether the back pointers are correctly
 *    set. Count all nodes in the table, and test each hash value
 *    to see whether it is correct for the node's chain.
 *
 * \return Returns true is the table is okay, else returns false.
 */
\brief Verify hash table consistency.

If \ref hash_self_verify enabled ), this
call is automatically called during hash table modification operations.

\par Notes & Steps:
\b 1.
If the hash table is dynamic, verify whether the high and
low expansion/shrinkage thresholds are powers of two.
\b 2.
For each chain, verify whether the back pointers are correctly
set. Count all nodes in the table, and test each hash value
to see whether it is correct for the node's chain.

\return Returns true is the table is okay, else returns false.
\ brief Verify hash table consistency . If \ ref hash_self_verify enabled ) this call is automatically called during hash table modification operations . \ par Notes & Steps : \ b 1 . If the hash table is dynamic verify whether the high and low expansion / shrinkage thresholds are powers of two . \ b 2 . For each chain verify whether the back pointers are correctly set . Count all nodes in the table and test each hash value to see whether it is correct for the node ' s chain . \ return Returns true is the table is okay else returns false .
bool_t hash_table_verify(hash_t *hash)
{
  hashcount_t count = 0;
  hash_val_t chain;
  hnode_t **npp;
  if (hash->dynamic)
  {
    CHKEXPR_ULONG(hash->lowmark, (hash->lowmark < hash->highmark), false);
    CHKEXPR_ULONG(hash->lowmark, is_power_of_two(hash->lowmark), false);
    CHKEXPR_ULONG(hash->highmark, is_power_of_two(hash->highmark), false);
  }
  for(chain = 0; chain < hash->nchains; chain++)
  {
    for(npp = hash->table + chain; *npp; npp = &(*npp)->next)
    {
      CHKEXPR_PTR(npp, ((*npp)->pself == npp), false);
      CHKEXPR_PTR(npp, (((*npp)->hkey & hash->mask) == chain), false);
      count++;
    }
  }
  CHKEXPR_ULONG(hash->count, (hash->count == count), false);
  return true;
}
bool_t hash_table_verify ( hash_t * hash ) { hashcount_t count = 0 ; hash_val_t chain ; hnode_t * * npp ; if ( hash -> dynamic ) { CHKEXPR_ULONG ( hash -> lowmark , ( hash -> lowmark < hash -> highmark ) , false ) ; CHKEXPR_ULONG ( hash -> lowmark , is_power_of_two ( hash -> lowmark ) , false ) ; CHKEXPR_ULONG ( hash -> highmark , is_power_of_two ( hash -> highmark ) , false ) ; } for ( chain = 0 ; chain < hash -> nchains ; chain ++ ) { for ( npp = hash -> table + chain ; * npp ; npp = & ( * npp ) -> next ) { CHKEXPR_PTR ( npp , ( ( * npp ) -> pself == npp ) , false ) ; CHKEXPR_PTR ( npp , ( ( ( * npp ) -> hkey & hash -> mask ) == chain ) , false ) ; count ++ ; } } CHKEXPR_ULONG ( hash -> count , ( hash -> count == count ) , false ) ; return true ; }
\brief Verify hash table consistency.
\ brief Verify hash table consistency .
// Step 1 // Step 2