mojoshader_common.c
changeset 1064 d3f0f4cf84f2
parent 1059 9655c606b39d
child 1065 bb021d539ec5
equal deleted inserted replaced
1063:b10281d6eb45 1064:d3f0f4cf84f2
    60 } // hash_find
    60 } // hash_find
    61 
    61 
    62 int hash_iter(const HashTable *table, const void *key,
    62 int hash_iter(const HashTable *table, const void *key,
    63               const void **_value, void **iter)
    63               const void **_value, void **iter)
    64 {
    64 {
    65     HashItem *i = *iter;
    65     HashItem *item = *iter;
    66     if (i == NULL)
    66     if (item == NULL)
    67         i = table->table[calc_hash(table, key)];
    67         item = table->table[calc_hash(table, key)];
    68     else
    68     else
    69         i = i->next;
    69         item = item->next;
    70 
    70 
    71     while (i != NULL)
    71     while (item != NULL)
    72     {
    72     {
    73         if (table->keymatch(key, i->key, table->data))
    73         if (table->keymatch(key, item->key, table->data))
    74         {
    74         {
    75             *_value = i->value;
    75             *_value = item->value;
    76             *iter = i;
    76             *iter = item;
    77             return 1;
    77             return 1;
    78         } // if
    78         } // if
    79         i = i->next;
    79         item = item->next;
    80     } // while
    80     } // while
    81 
    81 
    82     // no more matches.
    82     // no more matches.
    83     *_value = NULL;
    83     *_value = NULL;
    84     *iter = NULL;
    84     *iter = NULL;