Enlightenment CVS committal
Author : werkt
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore
Modified Files:
Ecore_Data.h ecore_hash.c
Log Message:
Fixes for ecore_hash_goto_first and ecore_hash_next
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Ecore_Data.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- Ecore_Data.h 4 Jan 2005 22:45:03 -0000 1.8
+++ Ecore_Data.h 5 Jan 2005 06:03:48 -0000 1.9
@@ -277,7 +277,6 @@
int nodes; /* The number of nodes currently in the hash */
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_Hash_Cb hash_func; /* The function used to compare node values */
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/ecore_hash.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- ecore_hash.c 5 Jan 2005 02:05:07 -0000 1.8
+++ ecore_hash.c 5 Jan 2005 06:03:48 -0000 1.9
@@ -207,18 +207,24 @@
*/
Ecore_Hash_Node *ecore_hash_goto_first(Ecore_Hash *hash)
{
+ Ecore_Hash_Node *node = NULL;
+
CHECK_PARAM_POINTER_RETURN("hash", hash, FALSE);
hash->index = 0;
ECORE_READ_LOCK(hash);
- if( hash->buckets[hash->index] )
- ecore_list_goto_first( hash->buckets[hash->index] );
+ while( hash->index < ecore_prime_table[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);
- return hash->current;
+ return node;
}
/**
@@ -235,16 +241,19 @@
ECORE_READ_LOCK(hash);
- if( hash->index < ecore_prime_table[hash->size] &&
- hash->buckets[hash->index] ) {
+ while( hash->index < ecore_prime_table[hash->size] &&
+ !hash->buckets[hash->index] ) {
+ hash->index++;
+ if( hash->index < ecore_prime_table[hash->size] &&
+ 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] );
if( !node ) {
hash->index++;
- while( hash->index < ecore_prime_table[hash->size] &&
- !hash->buckets[hash->index] )
- hash->index++;
- if( hash->index < ecore_prime_table[hash->size] )
- node = ecore_list_goto_first(
hash->buckets[hash->index] );
+ node = ecore_hash_next(hash);
}
}
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs