forked from enlightenment/efl
Fixes for ecore_hash_goto_first and ecore_hash_next
SVN revision: 12767
This commit is contained in:
parent
91d0cd0555
commit
260ad16e93
|
@ -277,7 +277,6 @@ extern "C" {
|
||||||
int nodes; /* The number of nodes currently in the hash */
|
int nodes; /* The number of nodes currently in the hash */
|
||||||
|
|
||||||
int index; /* The current index into the bucket table */
|
int index; /* The current index into the bucket table */
|
||||||
Ecore_Hash_Node *current; /* the current node in the current bucket */
|
|
||||||
|
|
||||||
Ecore_Compare_Cb compare; /* The function used to compare node values */
|
Ecore_Compare_Cb compare; /* The function used to compare node values */
|
||||||
Ecore_Hash_Cb hash_func; /* The function used to compare node values */
|
Ecore_Hash_Cb hash_func; /* The function used to compare node values */
|
||||||
|
|
|
@ -207,18 +207,24 @@ void ecore_hash_destroy(Ecore_Hash *hash)
|
||||||
*/
|
*/
|
||||||
Ecore_Hash_Node *ecore_hash_goto_first(Ecore_Hash *hash)
|
Ecore_Hash_Node *ecore_hash_goto_first(Ecore_Hash *hash)
|
||||||
{
|
{
|
||||||
|
Ecore_Hash_Node *node = NULL;
|
||||||
|
|
||||||
CHECK_PARAM_POINTER_RETURN("hash", hash, FALSE);
|
CHECK_PARAM_POINTER_RETURN("hash", hash, FALSE);
|
||||||
|
|
||||||
hash->index = 0;
|
hash->index = 0;
|
||||||
|
|
||||||
ECORE_READ_LOCK(hash);
|
ECORE_READ_LOCK(hash);
|
||||||
|
|
||||||
if( hash->buckets[hash->index] )
|
while( hash->index < ecore_prime_table[hash->index] &&
|
||||||
ecore_list_goto_first( hash->buckets[hash->index] );
|
!hash->buckets[hash->index] )
|
||||||
|
hash->index++;
|
||||||
|
|
||||||
|
if( hash->index < ecore_prime_table[hash->index] )
|
||||||
|
node = ecore_list_goto_first( hash->buckets[hash->index] );
|
||||||
|
|
||||||
ECORE_READ_UNLOCK(hash);
|
ECORE_READ_UNLOCK(hash);
|
||||||
|
|
||||||
return hash->current;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -235,16 +241,19 @@ Ecore_Hash_Node *ecore_hash_next(Ecore_Hash *hash)
|
||||||
|
|
||||||
ECORE_READ_LOCK(hash);
|
ECORE_READ_LOCK(hash);
|
||||||
|
|
||||||
|
while( hash->index < ecore_prime_table[hash->size] &&
|
||||||
|
!hash->buckets[hash->index] ) {
|
||||||
|
hash->index++;
|
||||||
if( hash->index < ecore_prime_table[hash->size] &&
|
if( hash->index < ecore_prime_table[hash->size] &&
|
||||||
hash->buckets[hash->index] ) {
|
hash->buckets[hash->index] )
|
||||||
|
ecore_list_goto_first( hash->buckets[hash->index] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( hash->index < ecore_prime_table[hash->size] ) {
|
||||||
node = ecore_list_next( hash->buckets[hash->index] );
|
node = ecore_list_next( hash->buckets[hash->index] );
|
||||||
if( !node ) {
|
if( !node ) {
|
||||||
hash->index++;
|
hash->index++;
|
||||||
while( hash->index < ecore_prime_table[hash->size] &&
|
node = ecore_hash_next(hash);
|
||||||
!hash->buckets[hash->index] )
|
|
||||||
hash->index++;
|
|
||||||
if( hash->index < ecore_prime_table[hash->size] )
|
|
||||||
node = ecore_list_goto_first( hash->buckets[hash->index] );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue