mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-05 05:14:13 +01:00
- Preliminary tree code
- added a key enumerator to hashtables (similar to value enumerator, just that it enumerates all keys in the hash)
This commit is contained in:
@@ -361,6 +361,33 @@ WMNextHashEnumeratorItem(WMHashEnumerator *enumerator)
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
WMNextHashEnumeratorKey(WMHashEnumerator *enumerator)
|
||||
{
|
||||
const void *key = NULL;
|
||||
|
||||
/* this assumes the table doesn't change between
|
||||
* WMEnumerateHashTable() and WMNextHashEnumeratorKey() calls */
|
||||
|
||||
if (enumerator->nextItem==NULL) {
|
||||
HashTable *table = enumerator->table;
|
||||
while (++enumerator->index < table->size) {
|
||||
if (table->table[enumerator->index]!=NULL) {
|
||||
enumerator->nextItem = table->table[enumerator->index];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (enumerator->nextItem) {
|
||||
key = ((HashItem*)enumerator->nextItem)->key;
|
||||
enumerator->nextItem = ((HashItem*)enumerator->nextItem)->next;
|
||||
}
|
||||
|
||||
return (void*)key;
|
||||
}
|
||||
|
||||
|
||||
unsigned
|
||||
WMCountHashTable(WMHashTable *table)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user