Changeset 7b0297b in mainline


Ignore:
Timestamp:
2009-04-06T15:31:31Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
44814b8
Parents:
5b7f418
Message:

split asserts into atomic conditions to ease debugging

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/adt/hash_table.c

    r5b7f418 r7b0297b  
    3333/**
    3434 * @file
    35  * @brief       Implementation of generic chained hash table.
     35 * @brief Implementation of generic chained hash table.
    3636 *
    3737 * This file contains implementation of generic chained hash table.
     
    5757
    5858        ASSERT(h);
    59         ASSERT(op && op->hash && op->compare);
     59        ASSERT(op);
     60        ASSERT(op->hash);
     61        ASSERT(op->compare);
    6062        ASSERT(max_keys > 0);
    6163       
    6264        h->entry = (link_t *) malloc(m * sizeof(link_t), 0);
    63         if (!h->entry) {
     65        if (!h->entry)
    6466                panic("Cannot allocate memory for hash table.");
    65         }
     67       
    6668        memsetb(h->entry, m * sizeof(link_t), 0);
    6769       
     
    8385{
    8486        index_t chain;
    85 
     87       
    8688        ASSERT(item);
    87         ASSERT(h && h->op && h->op->hash && h->op->compare);
    88 
     89        ASSERT(h);
     90        ASSERT(h->op);
     91        ASSERT(h->op->hash);
     92        ASSERT(h->op->compare);
     93       
    8994        chain = h->op->hash(key);
    9095        ASSERT(chain < h->entries);
     
    104109        link_t *cur;
    105110        index_t chain;
    106 
    107         ASSERT(h && h->op && h->op->hash && h->op->compare);
    108 
     111       
     112        ASSERT(h);
     113        ASSERT(h->op);
     114        ASSERT(h->op->hash);
     115        ASSERT(h->op->compare);
     116       
    109117        chain = h->op->hash(key);
    110118        ASSERT(chain < h->entries);
     
    134142        index_t chain;
    135143        link_t *cur;
    136 
    137         ASSERT(h && h->op && h->op->hash && h->op->compare && h->op->remove_callback);
     144       
     145        ASSERT(h);
     146        ASSERT(h->op);
     147        ASSERT(h->op->hash);
     148        ASSERT(h->op->compare);
     149        ASSERT(h->op->remove_callback);
    138150        ASSERT(keys <= h->max_keys);
    139151       
    140152        if (keys == h->max_keys) {
    141 
     153       
    142154                /*
    143155                 * All keys are known, hash_table_find() can be used to find the entry.
Note: See TracChangeset for help on using the changeset viewer.