Created
March 26, 2009 20:54
-
-
Save adh/86328 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char* dfsch_get_next_symbol(dfsch_symbol_iter_t **iter){ // deep magic | |
if (*iter == NULL){ | |
*iter = GC_MALLOC(sizeof(dfsch_symbol_iter_t)); | |
(*iter)->bucket = 0; | |
(*iter)->item = global_symbol_hash[(*iter)->bucket]; | |
} | |
while ((*iter)->bucket < HASH_SIZE){ | |
if (!(*iter)->item){ | |
(*iter)->bucket ++; | |
(*iter)->item = global_symbol_hash[(*iter)->bucket]; | |
}else{ | |
hash_entry_t *i = (*iter)->item; | |
(*iter)->item = (*iter)->item->next; | |
return i->entry->data; | |
} | |
} | |
return NULL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment