diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-12-20 20:36:08 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-12-20 20:36:08 (GMT) |
commit | 6878261a432d9cc8c705aa6c4f85450b29b37150 (patch) | |
tree | 765a4e072ef63bdda33320ca2c16938c5fa7a06f /src/H5SL.c | |
parent | 79a96581a64a4b2f8a6679100a7f369bb963ab94 (diff) | |
download | hdf5-6878261a432d9cc8c705aa6c4f85450b29b37150.zip hdf5-6878261a432d9cc8c705aa6c4f85450b29b37150.tar.gz hdf5-6878261a432d9cc8c705aa6c4f85450b29b37150.tar.bz2 |
[svn-r14353] Description:
- Add hash value for skip list string types, to reduce # of string
comparisons.
- Fixed bug with metadata/small data block aggregator adding size == 0
block into file free space list.
- Refactored metadata/small data block aggregator code into single set of
common routines.
- Changed block aggregator code to be smarter about releasing space in the
'other' block when the 'other' block has aggregated enough data.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'src/H5SL.c')
-rw-r--r-- | src/H5SL.c | 231 |
1 files changed, 126 insertions, 105 deletions
@@ -90,69 +90,93 @@ #define H5SL_LOCATE_FIND_FOUND(SLIST,X,UPDATE,I) \ HGOTO_DONE(X); -/* Define a code template for updating the "update" vector for the "DOUPDATE" in the H5SL_LOCATE macro */ -#define H5SL_LOCATE_YES_UPDATE(X,UPDATE,I) \ - UPDATE[I]=&X->forward[I]; -/* Define a code template for _NOT_ updating the "update" vector for the "DOUPDATE" in the H5SL_LOCATE macro */ -#define H5SL_LOCATE_NO_UPDATE(X,UPDATE,I) +/* Define a code template for "OP"s that update the "update" vector for the H5SL_LOCATE macro */ +#define H5SL_LOCATE_INSERT_UPDATE(X, UPDATE, I) \ + UPDATE[I] = &X->forward[I]; +#define H5SL_LOCATE_REMOVE_UPDATE(X, UPDATE, I) \ + UPDATE[I] = &X->forward[I]; + +/* Define a code template for "OP"s that _DON'T_ update the "update" vector for the H5SL_LOCATE macro */ +#define H5SL_LOCATE_SEARCH_UPDATE(X, UPDATE, I) +#define H5SL_LOCATE_FIND_UPDATE(X, UPDATE, I) + /* Define a code template for comparing scalar keys for the "CMP" in the H5SL_LOCATE macro */ -#define H5SL_LOCATE_SCALAR_CMP(TYPE,PKEY1,PKEY2) \ - (*(TYPE *)PKEY1 < *(TYPE *)PKEY2) +#define H5SL_LOCATE_SCALAR_CMP(TYPE, PNODE, PKEY, HASHVAL) \ + (*(TYPE *)((PNODE)->key) < *(TYPE *)PKEY) /* Define a code template for comparing string keys for the "CMP" in the H5SL_LOCATE macro */ -#define H5SL_LOCATE_STRING_CMP(TYPE,PKEY1,PKEY2) \ - (HDstrcmp(PKEY1, PKEY2) < 0) +#define H5SL_LOCATE_STRING_CMP(TYPE, PNODE, PKEY, HASHVAL) \ + (((PNODE)->hashval == HASHVAL) ? (HDstrcmp((PNODE)->key, PKEY) < 0) : ((PNODE)->hashval < HASHVAL)) /* Define a code template for comparing H5_obj_t keys for the "CMP" in the H5SL_LOCATE macro */ -#define H5SL_LOCATE_OBJ_CMP(TYPE,PKEY1,PKEY2) \ - ((((TYPE *)PKEY1)->fileno < ((TYPE *)PKEY2)->fileno) ? TRUE : (((TYPE *)PKEY1)->addr < ((TYPE *)PKEY2)->addr)) +#define H5SL_LOCATE_OBJ_CMP(TYPE, PNODE, PKEY, HASHVAL) \ + ((((TYPE *)((PNODE)->key))->fileno < ((TYPE *)PKEY)->fileno) ? TRUE : (((TYPE *)((PNODE)->key))->addr < ((TYPE *)PKEY)->addr)) + /* Define a code template for comparing scalar keys for the "EQ" in the H5SL_LOCATE macro */ -#define H5SL_LOCATE_SCALAR_EQ(TYPE,PKEY1,PKEY2) \ - (*(TYPE *)PKEY1 == *(TYPE *)PKEY2) +#define H5SL_LOCATE_SCALAR_EQ(TYPE, PNODE, PKEY, HASHVAL) \ + (*(TYPE *)((PNODE)->key) == *(TYPE *)PKEY) /* Define a code template for comparing string keys for the "EQ" in the H5SL_LOCATE macro */ -#define H5SL_LOCATE_STRING_EQ(TYPE,PKEY1,PKEY2) \ - (HDstrcmp(PKEY1, PKEY2) == 0) +#define H5SL_LOCATE_STRING_EQ(TYPE, PNODE, PKEY, HASHVAL) \ + (((PNODE)->hashval == HASHVAL) && (HDstrcmp(((PNODE)->key), PKEY) == 0)) + +/* Define a code template for comparing H5_obj_t keys for the "EQ" in the H5SL_LOCATE macro */ +#define H5SL_LOCATE_OBJ_EQ(TYPE, PNODE, PKEY, HASHVAL) \ + ((((TYPE *)((PNODE)->key))->fileno == ((TYPE *)PKEY)->fileno) && (((TYPE *)((PNODE)->key))->addr == ((TYPE *)PKEY)->addr)) + + +/* Define a code template for initializing the hash value for scalar keys for the "HASHINIT" in the H5SL_LOCATE macro */ +#define H5SL_LOCATE_SCALAR_HASHINIT(KEY, HASHVAL) + +/* Define a code template for initializing the hash value for string keys for the "HASHINIT" in the H5SL_LOCATE macro */ +#define H5SL_LOCATE_STRING_HASHINIT(KEY, HASHVAL) \ + HASHVAL = H5_hash_string(KEY); + +/* Define a code template for initializing the hash value for H5_obj_t keys for the "HASHINIT" in the H5SL_LOCATE macro */ +#define H5SL_LOCATE_OBJ_HASHINIT(KEY, HASHVAL) -/* Define a code template for comparing H5_obj_ keys for the "EQ" in the H5SL_LOCATE macro */ -#define H5SL_LOCATE_OBJ_EQ(TYPE,PKEY1,PKEY2) \ - ((((TYPE *)PKEY1)->fileno == ((TYPE *)PKEY2)->fileno) && (((TYPE *)PKEY1)->addr == ((TYPE *)PKEY2)->addr)) /* Macro used to find node for operation */ -#define H5SL_LOCATE(OP,DOUPDATE,CMP,SLIST,X,UPDATE,I,TYPE,KEY,CHECKED) \ - CHECKED=NULL; \ - for(I=(int)SLIST->curr_level; I>=0; I--) { \ - if(X->forward[I]!=CHECKED) { \ - while(X->forward[I] && H5_GLUE3(H5SL_LOCATE_,CMP,_CMP)(TYPE,X->forward[I]->key,KEY) ) \ - X=X->forward[I]; \ - CHECKED=X->forward[I]; \ +#define H5SL_LOCATE(OP, CMP, SLIST, X, UPDATE, TYPE, KEY, HASHVAL) \ +{ \ + H5SL_node_t *_checked; /* Pointer to last node checked */ \ + int _i; /* Local index variable */ \ + \ + _checked = NULL; \ + H5_GLUE3(H5SL_LOCATE_,CMP,_HASHINIT)(KEY, HASHVAL) \ + for(_i = (int)SLIST->curr_level; _i >= 0; _i--) { \ + if(X->forward[_i] != _checked) { \ + while(X->forward[_i] && H5_GLUE3(H5SL_LOCATE_,CMP,_CMP)(TYPE, X->forward[_i], KEY, HASHVAL) ) \ + X = X->forward[_i]; \ + _checked = X->forward[_i]; \ } /* end if */ \ - H5_GLUE3(H5SL_LOCATE_,DOUPDATE,_UPDATE)(X,UPDATE,I) \ + H5_GLUE3(H5SL_LOCATE_,OP,_UPDATE)(X, UPDATE, _i) \ } /* end for */ \ - X=X->forward[0]; \ - if(X!=NULL && H5_GLUE3(H5SL_LOCATE_,CMP,_EQ)(TYPE,X->key,KEY) ) { \ + X = X->forward[0]; \ + if(X != NULL && H5_GLUE3(H5SL_LOCATE_,CMP,_EQ)(TYPE, X, KEY, HASHVAL) ) { \ /* What to do when a node is found */ \ - H5_GLUE3(H5SL_LOCATE_,OP,_FOUND)(SLIST,X,UPDATE,I) \ - } /* end if */ + H5_GLUE3(H5SL_LOCATE_,OP,_FOUND)(SLIST, X, UPDATE, _i) \ + } /* end if */ \ +} /* Macro used to insert node */ -#define H5SL_INSERT(CMP, SLIST, X, UPDATE, I, TYPE, KEY, CHECKED) \ - H5SL_LOCATE(INSERT, YES, CMP, SLIST, X, UPDATE, I, TYPE, KEY, CHECKED) +#define H5SL_INSERT(CMP, SLIST, X, UPDATE, TYPE, KEY, HASHVAL) \ + H5SL_LOCATE(INSERT, CMP, SLIST, X, UPDATE, TYPE, KEY, HASHVAL) /* Macro used to remove node */ -#define H5SL_REMOVE(CMP, SLIST, X, UPDATE, I, TYPE, KEY, CHECKED) \ - H5SL_LOCATE(REMOVE, YES, CMP, SLIST, X, UPDATE, I, TYPE, KEY, CHECKED) +#define H5SL_REMOVE(CMP, SLIST, X, UPDATE, TYPE, KEY, HASHVAL) \ + H5SL_LOCATE(REMOVE, CMP, SLIST, X, UPDATE, TYPE, KEY, HASHVAL) /* Macro used to search for node */ -#define H5SL_SEARCH(CMP, SLIST, X, UPDATE, I, TYPE, KEY, CHECKED) \ - H5SL_LOCATE(SEARCH, NO, CMP, SLIST, X, UPDATE, I, TYPE, KEY, CHECKED) +#define H5SL_SEARCH(CMP, SLIST, X, UPDATE, TYPE, KEY, HASHVAL) \ + H5SL_LOCATE(SEARCH, CMP, SLIST, X, UPDATE, TYPE, KEY, HASHVAL) /* Macro used to find a node */ -#define H5SL_FIND(CMP, SLIST, X, UPDATE, I, TYPE, KEY, CHECKED) \ - H5SL_LOCATE(FIND, NO, CMP, SLIST, X, UPDATE, I, TYPE, KEY, CHECKED) +#define H5SL_FIND(CMP, SLIST, X, UPDATE, TYPE, KEY, HASHVAL) \ + H5SL_LOCATE(FIND, CMP, SLIST, X, UPDATE, TYPE, KEY, HASHVAL) /* Private typedefs & structs */ @@ -162,6 +186,7 @@ struct H5SL_node_t { const void *key; /* Pointer to node's key */ void *item; /* Pointer to node's item */ size_t level; /* The level of this node */ + uint32_t hashval; /* Hash value for key (only for strings, currently) */ struct H5SL_node_t **forward; /* Array of forward pointers from this node */ struct H5SL_node_t *backward; /* Backward pointer from this node */ }; @@ -183,7 +208,7 @@ struct H5SL_t { /* Static functions */ static size_t H5SL_random_level(int p1, size_t max_level); -static H5SL_node_t * H5SL_new_node(size_t lvl, void *item, const void *key); +static H5SL_node_t * H5SL_new_node(size_t lvl, void *item, const void *key, uint32_t hashval); static H5SL_node_t *H5SL_insert_common(H5SL_t *slist, void *item, const void *key); static herr_t H5SL_release_common(H5SL_t *slist, H5SL_operator_t op, void *op_data); static herr_t H5SL_close_common(H5SL_t *slist, H5SL_operator_t op, void *op_data); @@ -295,24 +320,25 @@ H5SL_random_level(int p1, size_t max_level) REVISION LOG --------------------------------------------------------------------------*/ static H5SL_node_t * -H5SL_new_node(size_t lvl, void *item, const void *key) +H5SL_new_node(size_t lvl, void *item, const void *key, uint32_t hashval) { H5SL_node_t *ret_value; /* New skip list node */ - FUNC_ENTER_NOAPI_NOINIT(H5SL_new_node); + FUNC_ENTER_NOAPI_NOINIT(H5SL_new_node) /* Allocate the node */ - if((ret_value=H5FL_ARR_MALLOC(H5SL_node_ptr_t,(lvl+1)))==NULL) - HGOTO_ERROR(H5E_SLIST,H5E_NOSPACE,NULL,"memory allocation failed"); + if(NULL == (ret_value = H5FL_ARR_MALLOC(H5SL_node_ptr_t, (lvl + 1)))) + HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "memory allocation failed") /* Initialize node */ - ret_value->key=key; - ret_value->item=item; - ret_value->level=lvl; - ret_value->forward=(H5SL_node_t **)((unsigned char *)ret_value+sizeof(H5SL_node_t)); + ret_value->key = key; + ret_value->item = item; + ret_value->level = lvl; + ret_value->hashval = hashval; + ret_value->forward = (H5SL_node_t **)((unsigned char *)ret_value + sizeof(H5SL_node_t)); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5SL_new_node() */ @@ -341,8 +367,8 @@ static H5SL_node_t * H5SL_insert_common(H5SL_t *slist, void *item, const void *key) { H5SL_node_t **update[H5SL_LEVEL_MAX]; /* 'update' vector */ - H5SL_node_t *checked; /* Pointer to last node checked */ H5SL_node_t *x; /* Current node to examine */ + uint32_t hashval = 0; /* Hash value for key */ size_t lvl; /* Level of new node */ int i; /* Local index value */ H5SL_node_t *ret_value; /* Return value */ @@ -364,31 +390,31 @@ H5SL_insert_common(H5SL_t *slist, void *item, const void *key) x=slist->header; switch(slist->type) { case H5SL_TYPE_INT: - H5SL_INSERT(SCALAR, slist, x, update, i, const int, key, checked) + H5SL_INSERT(SCALAR, slist, x, update, const int, key, -) break; case H5SL_TYPE_HADDR: - H5SL_INSERT(SCALAR, slist, x, update, i, const haddr_t, key, checked) + H5SL_INSERT(SCALAR, slist, x, update, const haddr_t, key, -) break; case H5SL_TYPE_STR: - H5SL_INSERT(STRING, slist, x, update, i, char *, key, checked) + H5SL_INSERT(STRING, slist, x, update, char *, key, hashval) break; case H5SL_TYPE_HSIZE: - H5SL_INSERT(SCALAR, slist, x, update, i, const hsize_t, key, checked) + H5SL_INSERT(SCALAR, slist, x, update, const hsize_t, key, -) break; case H5SL_TYPE_UNSIGNED: - H5SL_INSERT(SCALAR, slist, x, update, i, const unsigned, key, checked) + H5SL_INSERT(SCALAR, slist, x, update, const unsigned, key, -) break; case H5SL_TYPE_SIZE: - H5SL_INSERT(SCALAR, slist, x, update, i, const size_t, key, checked) + H5SL_INSERT(SCALAR, slist, x, update, const size_t, key, -) break; case H5SL_TYPE_OBJ: - H5SL_INSERT(OBJ, slist, x, update, i, const H5_obj_t, key, checked) + H5SL_INSERT(OBJ, slist, x, update, const H5_obj_t, key, -) break; } /* end switch */ @@ -408,8 +434,8 @@ H5SL_insert_common(H5SL_t *slist, void *item, const void *key) } /* end if */ /* Create new node of proper level */ - if((x=H5SL_new_node(lvl,item,key))==NULL) - HGOTO_ERROR(H5E_SLIST,H5E_NOSPACE,NULL,"can't create new skip list node"); + if(NULL == (x = H5SL_new_node(lvl, item, key, hashval))) + HGOTO_ERROR(H5E_SLIST ,H5E_NOSPACE, NULL, "can't create new skip list node") /* Update the backward links */ if(*update[0]!=NULL) { @@ -600,8 +626,8 @@ H5SL_create(H5SL_type_t type, double p, size_t max_level) new_slist->nobjs=0; /* Allocate the header node */ - if((header=H5SL_new_node(max_level-1,NULL,NULL))==NULL) - HGOTO_ERROR(H5E_SLIST,H5E_NOSPACE,NULL,"memory allocation failed"); + if(NULL == (header = H5SL_new_node((max_level - 1), NULL, NULL, ULONG_MAX))) + HGOTO_ERROR(H5E_SLIST ,H5E_NOSPACE, NULL, "can't create new skip list node") /* Initialize header node's forward pointers */ for(u=0; u<max_level; u++) @@ -776,9 +802,8 @@ void * H5SL_remove(H5SL_t *slist, const void *key) { H5SL_node_t **update[H5SL_LEVEL_MAX]; /* 'update' vector */ - H5SL_node_t *checked; /* Pointer to last node checked */ H5SL_node_t *x; /* Current node to examine */ - int i; /* Local index value */ + uint32_t hashval = 0; /* Hash value for key */ void *ret_value=NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SL_remove); @@ -798,31 +823,31 @@ H5SL_remove(H5SL_t *slist, const void *key) x=slist->header; switch(slist->type) { case H5SL_TYPE_INT: - H5SL_REMOVE(SCALAR, slist, x, update, i, const int, key, checked) + H5SL_REMOVE(SCALAR, slist, x, update, const int, key, -) break; case H5SL_TYPE_HADDR: - H5SL_REMOVE(SCALAR, slist, x, update, i, const haddr_t, key, checked) + H5SL_REMOVE(SCALAR, slist, x, update, const haddr_t, key, -) break; case H5SL_TYPE_STR: - H5SL_REMOVE(STRING, slist, x, update, i, char *, key, checked) + H5SL_REMOVE(STRING, slist, x, update, char *, key, hashval) break; case H5SL_TYPE_HSIZE: - H5SL_REMOVE(SCALAR, slist, x, update, i, const hsize_t, key, checked) + H5SL_REMOVE(SCALAR, slist, x, update, const hsize_t, key, -) break; case H5SL_TYPE_UNSIGNED: - H5SL_REMOVE(SCALAR, slist, x, update, i, const unsigned, key, checked) + H5SL_REMOVE(SCALAR, slist, x, update, const unsigned, key, -) break; case H5SL_TYPE_SIZE: - H5SL_REMOVE(SCALAR, slist, x, update, i, const size_t, key, checked) + H5SL_REMOVE(SCALAR, slist, x, update, const size_t, key, -) break; case H5SL_TYPE_OBJ: - H5SL_REMOVE(OBJ, slist, x, update, i, const H5_obj_t, key, checked) + H5SL_REMOVE(OBJ, slist, x, update, const H5_obj_t, key, -) break; } /* end switch */ @@ -927,9 +952,8 @@ H5SL_remove_first(H5SL_t *slist) void * H5SL_search(H5SL_t *slist, const void *key) { - H5SL_node_t *checked; /* Pointer to last node checked */ H5SL_node_t *x; /* Current node to examine */ - int i; /* Local index value */ + uint32_t hashval = 0; /* Hash value for key */ void *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SL_search); @@ -949,31 +973,31 @@ H5SL_search(H5SL_t *slist, const void *key) x=slist->header; switch(slist->type) { case H5SL_TYPE_INT: - H5SL_SEARCH(SCALAR, slist, x, -, i, const int, key, checked) + H5SL_SEARCH(SCALAR, slist, x, -, const int, key, -) break; case H5SL_TYPE_HADDR: - H5SL_SEARCH(SCALAR, slist, x, -, i, const haddr_t, key, checked) + H5SL_SEARCH(SCALAR, slist, x, -, const haddr_t, key, -) break; case H5SL_TYPE_STR: - H5SL_SEARCH(STRING, slist, x, -, i, char *, key, checked) + H5SL_SEARCH(STRING, slist, x, -, char *, key, hashval) break; case H5SL_TYPE_HSIZE: - H5SL_SEARCH(SCALAR, slist, x, -, i, const hsize_t, key, checked) + H5SL_SEARCH(SCALAR, slist, x, -, const hsize_t, key, -) break; case H5SL_TYPE_UNSIGNED: - H5SL_SEARCH(SCALAR, slist, x, -, i, const unsigned, key, checked) + H5SL_SEARCH(SCALAR, slist, x, -, const unsigned, key, -) break; case H5SL_TYPE_SIZE: - H5SL_SEARCH(SCALAR, slist, x, -, i, const size_t, key, checked) + H5SL_SEARCH(SCALAR, slist, x, -, const size_t, key, -) break; case H5SL_TYPE_OBJ: - H5SL_SEARCH(OBJ, slist, x, -, i, const H5_obj_t, key, checked) + H5SL_SEARCH(OBJ, slist, x, -, const H5_obj_t, key, -) break; } /* end switch */ @@ -1010,9 +1034,8 @@ done: void * H5SL_less(H5SL_t *slist, const void *key) { - H5SL_node_t *checked; /* Pointer to last node checked */ H5SL_node_t *x; /* Current node to examine */ - int i; /* Local index value */ + uint32_t hashval = 0; /* Hash value for key */ void *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SL_less); @@ -1032,31 +1055,31 @@ H5SL_less(H5SL_t *slist, const void *key) x=slist->header; switch(slist->type) { case H5SL_TYPE_INT: - H5SL_SEARCH(SCALAR, slist, x, -, i, const int, key, checked) + H5SL_SEARCH(SCALAR, slist, x, -, const int, key, -) break; case H5SL_TYPE_HADDR: - H5SL_SEARCH(SCALAR, slist, x, -, i, const haddr_t, key, checked) + H5SL_SEARCH(SCALAR, slist, x, -, const haddr_t, key, -) break; case H5SL_TYPE_STR: - H5SL_SEARCH(STRING, slist, x, -, i, char *, key, checked) + H5SL_SEARCH(STRING, slist, x, -, char *, key, hashval) break; case H5SL_TYPE_HSIZE: - H5SL_SEARCH(SCALAR, slist, x, -, i, const hsize_t, key, checked) + H5SL_SEARCH(SCALAR, slist, x, -, const hsize_t, key, -) break; case H5SL_TYPE_UNSIGNED: - H5SL_SEARCH(SCALAR, slist, x, -, i, const unsigned, key, checked) + H5SL_SEARCH(SCALAR, slist, x, -, const unsigned, key, -) break; case H5SL_TYPE_SIZE: - H5SL_SEARCH(SCALAR, slist, x, -, i, const size_t, key, checked) + H5SL_SEARCH(SCALAR, slist, x, -, const size_t, key, -) break; case H5SL_TYPE_OBJ: - H5SL_SEARCH(OBJ, slist, x, -, i, const H5_obj_t, key, checked) + H5SL_SEARCH(OBJ, slist, x, -, const H5_obj_t, key, -) break; } /* end switch */ @@ -1106,9 +1129,8 @@ done: void * H5SL_greater(H5SL_t *slist, const void *key) { - H5SL_node_t *checked; /* Pointer to last node checked */ H5SL_node_t *x; /* Current node to examine */ - int i; /* Local index value */ + uint32_t hashval = 0; /* Hash value for key */ void *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SL_greater); @@ -1128,31 +1150,31 @@ H5SL_greater(H5SL_t *slist, const void *key) x = slist->header; switch(slist->type) { case H5SL_TYPE_INT: - H5SL_SEARCH(SCALAR, slist, x, -, i, const int, key, checked) + H5SL_SEARCH(SCALAR, slist, x, -, const int, key, -) break; case H5SL_TYPE_HADDR: - H5SL_SEARCH(SCALAR, slist, x, -, i, const haddr_t, key, checked) + H5SL_SEARCH(SCALAR, slist, x, -, const haddr_t, key, -) break; case H5SL_TYPE_STR: - H5SL_SEARCH(STRING, slist, x, -, i, char *, key, checked) + H5SL_SEARCH(STRING, slist, x, -, char *, key, hashval) break; case H5SL_TYPE_HSIZE: - H5SL_SEARCH(SCALAR, slist, x, -, i, const hsize_t, key, checked) + H5SL_SEARCH(SCALAR, slist, x, -, const hsize_t, key, -) break; case H5SL_TYPE_UNSIGNED: - H5SL_SEARCH(SCALAR, slist, x, -, i, const unsigned, key, checked) + H5SL_SEARCH(SCALAR, slist, x, -, const unsigned, key, -) break; case H5SL_TYPE_SIZE: - H5SL_SEARCH(SCALAR, slist, x, -, i, const size_t, key, checked) + H5SL_SEARCH(SCALAR, slist, x, -, const size_t, key, -) break; case H5SL_TYPE_OBJ: - H5SL_SEARCH(OBJ, slist, x, -, i, const H5_obj_t, key, checked) + H5SL_SEARCH(OBJ, slist, x, -, const H5_obj_t, key, -) break; } /* end switch */ @@ -1192,9 +1214,8 @@ done: H5SL_node_t * H5SL_find(H5SL_t *slist, const void *key) { - H5SL_node_t *checked; /* Pointer to last node checked */ H5SL_node_t *x; /* Current node to examine */ - int i; /* Local index value */ + uint32_t hashval = 0; /* Hash value for key */ H5SL_node_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SL_find); @@ -1214,31 +1235,31 @@ H5SL_find(H5SL_t *slist, const void *key) x=slist->header; switch(slist->type) { case H5SL_TYPE_INT: - H5SL_FIND(SCALAR, slist, x, -, i, const int, key, checked) + H5SL_FIND(SCALAR, slist, x, -, const int, key, -) break; case H5SL_TYPE_HADDR: - H5SL_FIND(SCALAR, slist, x, -, i, const haddr_t, key, checked) + H5SL_FIND(SCALAR, slist, x, -, const haddr_t, key, -) break; case H5SL_TYPE_STR: - H5SL_FIND(STRING, slist, x, -, i, char *, key, checked) + H5SL_FIND(STRING, slist, x, -, char *, key, hashval) break; case H5SL_TYPE_HSIZE: - H5SL_FIND(SCALAR, slist, x, -, i, const hsize_t, key, checked) + H5SL_FIND(SCALAR, slist, x, -, const hsize_t, key, -) break; case H5SL_TYPE_UNSIGNED: - H5SL_FIND(SCALAR, slist, x, -, i, const unsigned, key, checked) + H5SL_FIND(SCALAR, slist, x, -, const unsigned, key, -) break; case H5SL_TYPE_SIZE: - H5SL_FIND(SCALAR, slist, x, -, i, const size_t, key, checked) + H5SL_FIND(SCALAR, slist, x, -, const size_t, key, -) break; case H5SL_TYPE_OBJ: - H5SL_FIND(OBJ, slist, x, -, i, const H5_obj_t, key, checked) + H5SL_FIND(OBJ, slist, x, -, const H5_obj_t, key, -) break; } /* end switch */ |