[svn-r16698] Purpose: Fix bug 503

Description:
Changed Skip list package to use a deterministic skip list.  This allows the
skip list package to avoid calling rand() and srand(), even on machines without
rand_r().  There is no longer a p-value or maximum level for skip lists.

Tested: jam, smirom, linew (h5committest)
This commit is contained in:
Neil Fortner 2009-04-08 12:02:09 -05:00
parent 837ab64fa7
commit a4aae55760
16 changed files with 685 additions and 333 deletions

View File

@ -151,6 +151,8 @@ Bug Fixes since HDF5-1.8.0 release
Library
-------
- Changed skip lists to use a deterministic algorithm. The library should
now never call rand() or srand(). (NAF - 2009/04/08 - 503)
- Fixed a bug where H5Lcopy and H5Lmove wouldn't create intermediate
groups when that property was set. (NAF - 2009/04/07 - 1526)
- Fixed a bug that caused files with a user block to grow by the size of

View File

@ -28,6 +28,7 @@
#include "H5Lprivate.h" /* Links */
#include "H5Pprivate.h" /* Property lists */
#include "H5Tprivate.h" /* Datatypes */
#include "H5SLprivate.h" /* Skip lists */
/****************/
@ -270,6 +271,9 @@ H5_term_library(void)
/* Don't shut down the ID code until other APIs which use them are shut down */
if(pending == 0)
pending += DOWN(I);
/* Don't shut down the skip list code until everything that uses it is down */
if(pending == 0)
pending += DOWN(SL);
/* Don't shut down the free list code until _everything_ else is down */
if(pending == 0)
pending += DOWN(FL);

View File

@ -589,7 +589,7 @@ H5AC_create(const H5F_t *f,
if ( mpi_rank == 0 ) {
aux_ptr->d_slist_ptr =
H5SL_create(H5SL_TYPE_HADDR,0.5,(size_t)16);
H5SL_create(H5SL_TYPE_HADDR);
if ( aux_ptr->d_slist_ptr == NULL ) {
@ -598,7 +598,7 @@ H5AC_create(const H5F_t *f,
}
aux_ptr->c_slist_ptr =
H5SL_create(H5SL_TYPE_HADDR,0.5,(size_t)16);
H5SL_create(H5SL_TYPE_HADDR);
if ( aux_ptr->c_slist_ptr == NULL ) {

View File

@ -3046,8 +3046,7 @@ H5C_create(size_t max_cache_size,
"memory allocation failed")
}
if ( (cache_ptr->slist_ptr = H5SL_create(H5SL_TYPE_HADDR,0.5,(size_t)16))
== NULL ) {
if ( (cache_ptr->slist_ptr = H5SL_create(H5SL_TYPE_HADDR)) == NULL ) {
HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, NULL, "can't create skip list.")
}

View File

@ -36,9 +36,6 @@
/* Local Macros */
/****************/
/* Default skip list height for storing list of chunks */
#define H5D_CHUNK_DEFAULT_SKIPLIST_HEIGHT 8
/* Macros for iterating over chunks to operate on */
#define H5D_CHUNK_GET_FIRST_NODE(map) (map->use_single ? (H5SL_node_t *)(1) : H5SL_first(map->sel_chunks))
#define H5D_CHUNK_GET_NODE_INFO(map, node) (map->use_single ? map->single_chunk_info : (H5D_chunk_info_t *)H5SL_item(node))
@ -495,7 +492,7 @@ H5D_chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info
else {
/* Initialize skip list for chunk selections */
if(NULL == dataset->shared->cache.chunk.sel_chunks) {
if(NULL == (dataset->shared->cache.chunk.sel_chunks = H5SL_create(H5SL_TYPE_HSIZE, 0.5, (size_t)H5D_CHUNK_DEFAULT_SKIPLIST_HEIGHT)))
if(NULL == (dataset->shared->cache.chunk.sel_chunks = H5SL_create(H5SL_TYPE_HSIZE)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for chunk selections")
} /* end if */
fm->sel_chunks = dataset->shared->cache.chunk.sel_chunks;

View File

@ -82,7 +82,7 @@ H5FO_create(const H5F_t *f)
assert(f->shared);
/* Create container used to store open object info */
if((f->shared->open_objs = H5SL_create(H5SL_TYPE_HADDR, 0.5, (size_t)16)) == NULL)
if((f->shared->open_objs = H5SL_create(H5SL_TYPE_HADDR)) == NULL)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create open object container")
done:
@ -400,7 +400,7 @@ H5FO_top_create(H5F_t *f)
HDassert(f);
/* Create container used to store open object info */
if((f->obj_count = H5SL_create(H5SL_TYPE_HADDR, 0.5, (size_t)16)) == NULL)
if((f->obj_count = H5SL_create(H5SL_TYPE_HADDR)) == NULL)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create open object container")
done:

View File

@ -45,9 +45,6 @@
/* Default starting size of section buffer */
#define H5FS_SINFO_SIZE_DEFAULT 64
/* Max. height of the skip list holding free list nodes */
#define H5FS_DEFAULT_SKIPLIST_HEIGHT 16
/******************/
/* Local Typedefs */
@ -962,7 +959,7 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, s
bin = H5V_log2_gen(sect->size);
HDassert(bin < sinfo->nbins);
if(sinfo->bins[bin].bin_list == NULL) {
if(NULL == (sinfo->bins[bin].bin_list = H5SL_create(H5SL_TYPE_HSIZE, 0.5, (size_t)H5FS_DEFAULT_SKIPLIST_HEIGHT)))
if(NULL == (sinfo->bins[bin].bin_list = H5SL_create(H5SL_TYPE_HSIZE)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create skip list for free space nodes")
} /* end if */
else {
@ -979,7 +976,7 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, s
/* Initialize the free list size node */
fspace_node->sect_size = sect->size;
fspace_node->serial_count = fspace_node->ghost_count = 0;
if(NULL == (fspace_node->sect_list = H5SL_create(H5SL_TYPE_HADDR, 0.5, (size_t)H5FS_DEFAULT_SKIPLIST_HEIGHT)))
if(NULL == (fspace_node->sect_list = H5SL_create(H5SL_TYPE_HADDR)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create skip list for free space nodes")
/* Insert new free space size node into bin's list */
@ -1058,7 +1055,7 @@ H5FS_sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls,
HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUNC, (unsigned)sect->type);
#endif /* QAK */
if(fspace->sinfo->merge_list == NULL)
if(NULL == (fspace->sinfo->merge_list = H5SL_create(H5SL_TYPE_HADDR, 0.5, (size_t)H5FS_DEFAULT_SKIPLIST_HEIGHT)))
if(NULL == (fspace->sinfo->merge_list = H5SL_create(H5SL_TYPE_HADDR)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create skip list for merging free space sections")
if(H5SL_insert(fspace->sinfo->merge_list, sect, &sect->addr) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space node into merging skip list")
@ -2101,7 +2098,7 @@ HDfprintf(stderr, "%s: to_mergable = %u\n", FUNC, to_mergable);
HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUNC, (unsigned)sect->type);
#endif /* QAK */
if(fspace->sinfo->merge_list == NULL)
if(NULL == (fspace->sinfo->merge_list = H5SL_create(H5SL_TYPE_HADDR, 0.5, (size_t)H5FS_DEFAULT_SKIPLIST_HEIGHT)))
if(NULL == (fspace->sinfo->merge_list = H5SL_create(H5SL_TYPE_HADDR)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create skip list for merging free space sections")
if(H5SL_insert(fspace->sinfo->merge_list, sect, &sect->addr) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space node into merging skip list")

View File

@ -1975,7 +1975,7 @@ H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type,
udata.curr_path_len = 0;
/* Create skip list to store visited object information */
if((udata.visited = H5SL_create(H5SL_TYPE_OBJ, 0.5, (size_t)16)) == NULL)
if((udata.visited = H5SL_create(H5SL_TYPE_OBJ)) == NULL)
HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "can't create skip list for visited objects")
/* Get the group's reference count and type */

View File

@ -1847,7 +1847,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Iis_valid
*
* Purpose: Check if the given id is valid. And id is valid if it is in
* Purpose: Check if the given id is valid. An id is valid if it is in
* use and has an application reference count of at least 1.
*
* Return: Success: TRUE if the id is valid, FALSE otherwise.

View File

@ -2879,7 +2879,7 @@ H5O_visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
udata.op_data = op_data;
/* Create skip list to store visited object information */
if((udata.visited = H5SL_create(H5SL_TYPE_OBJ, 0.5, (size_t)16)) == NULL)
if((udata.visited = H5SL_create(H5SL_TYPE_OBJ)) == NULL)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create skip list for visited objects")
/* If its ref count is > 1, we add it to the list of visited objects */

View File

@ -913,7 +913,7 @@ H5O_copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
cpy_info.preserve_null = TRUE;
/* Create a skip list to keep track of which objects are copied */
if((cpy_info.map_list = H5SL_create(H5SL_TYPE_HADDR, 0.5, (size_t)16)) == NULL)
if((cpy_info.map_list = H5SL_create(H5SL_TYPE_HADDR)) == NULL)
HGOTO_ERROR(H5E_SLIST, H5E_CANTCREATE, FAIL, "cannot make skip list")
/* copy the object from the source file to the destination file */

View File

@ -42,8 +42,6 @@
/* Local Macros */
/****************/
#define H5P_DEFAULT_SKIPLIST_HEIGHT 8
/******************/
/* Local Typedefs */
@ -652,11 +650,11 @@ H5P_copy_plist(H5P_genplist_t *old_plist, hbool_t app_ref)
new_plist->class_init = 0; /* Initially, wait until the class callback finishes to set */
/* Initialize the skip list to hold the changed properties */
if((new_plist->props = H5SL_create(H5SL_TYPE_STR, 0.5, (size_t)H5P_DEFAULT_SKIPLIST_HEIGHT)) == NULL)
if((new_plist->props = H5SL_create(H5SL_TYPE_STR)) == NULL)
HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for changed properties");
/* Create the skip list for deleted properties */
if((new_plist->del = H5SL_create(H5SL_TYPE_STR, 0.5, (size_t)H5P_DEFAULT_SKIPLIST_HEIGHT)) == NULL)
if((new_plist->del = H5SL_create(H5SL_TYPE_STR)) == NULL)
HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for deleted properties");
/* Create the skip list to hold names of properties already seen
@ -664,7 +662,7 @@ H5P_copy_plist(H5P_genplist_t *old_plist, hbool_t app_ref)
* 'create' callback called, if a property in the class hierarchy has
* already been seen)
*/
if((seen = H5SL_create(H5SL_TYPE_STR, 0.5, (size_t)H5P_DEFAULT_SKIPLIST_HEIGHT))== NULL)
if((seen = H5SL_create(H5SL_TYPE_STR))== NULL)
HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for seen properties");
nseen = 0;
@ -1462,7 +1460,7 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, unsigned internal,
pclass->revision = H5P_GET_NEXT_REV; /* Get a revision number for the class */
/* Create the skip list for properties */
if((pclass->props = H5SL_create(H5SL_TYPE_STR, 0.5, (size_t)H5P_DEFAULT_SKIPLIST_HEIGHT)) == NULL)
if((pclass->props = H5SL_create(H5SL_TYPE_STR)) == NULL)
HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,NULL,"can't create skip list for properties");
/* Set callback functions and pass-along data */
@ -1544,11 +1542,11 @@ H5P_create(H5P_genclass_t *pclass)
plist->class_init = 0; /* Initially, wait until the class callback finishes to set */
/* Create the skip list for changed properties */
if((plist->props = H5SL_create(H5SL_TYPE_STR, 0.5, (size_t)H5P_DEFAULT_SKIPLIST_HEIGHT)) == NULL)
if((plist->props = H5SL_create(H5SL_TYPE_STR)) == NULL)
HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,NULL,"can't create skip list for changed properties");
/* Create the skip list for deleted properties */
if((plist->del = H5SL_create(H5SL_TYPE_STR, 0.5, (size_t)H5P_DEFAULT_SKIPLIST_HEIGHT)) == NULL)
if((plist->del = H5SL_create(H5SL_TYPE_STR)) == NULL)
HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,NULL,"can't create skip list for deleted properties");
/* Create the skip list to hold names of properties already seen
@ -1556,7 +1554,7 @@ H5P_create(H5P_genclass_t *pclass)
* 'create' callback called, if a property in the class hierarchy has
* already been seen)
*/
if((seen = H5SL_create(H5SL_TYPE_STR, 0.5, (size_t)H5P_DEFAULT_SKIPLIST_HEIGHT)) == NULL)
if((seen = H5SL_create(H5SL_TYPE_STR)) == NULL)
HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,NULL,"can't create skip list for seen properties");
/*
@ -3147,7 +3145,7 @@ H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_t iter_func, void *iter_
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
/* Create the skip list to hold names of properties already seen */
if((seen = H5SL_create(H5SL_TYPE_STR, 0.5, (size_t)H5P_DEFAULT_SKIPLIST_HEIGHT)) == NULL)
if((seen = H5SL_create(H5SL_TYPE_STR)) == NULL)
HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for seen properties");
/* Walk through the changed properties in the list */
@ -4071,7 +4069,7 @@ H5P_close(void *_plist)
* 'close' callback called, if a property in the class hierarchy has
* already been seen)
*/
if((seen = H5SL_create(H5SL_TYPE_STR, 0.5, (size_t)H5P_DEFAULT_SKIPLIST_HEIGHT)) == NULL)
if((seen = H5SL_create(H5SL_TYPE_STR)) == NULL)
HGOTO_ERROR(H5E_PLIST,H5E_CANTCREATE,FAIL,"can't create skip list for seen properties");
nseen = 0;

File diff suppressed because it is too large Load Diff

View File

@ -53,7 +53,6 @@ typedef enum {
/**********/
/* Macros */
/**********/
#define H5SL_LEVEL_MAX 32 /* (for now) */
/* Typedef for iteration operations */
typedef herr_t (*H5SL_operator_t)(void *item, void *key,
@ -62,7 +61,7 @@ typedef herr_t (*H5SL_operator_t)(void *item, void *key,
/********************/
/* Private routines */
/********************/
H5_DLL H5SL_t *H5SL_create(H5SL_type_t type, double p, size_t max_level);
H5_DLL H5SL_t *H5SL_create(H5SL_type_t type);
H5_DLL size_t H5SL_count(H5SL_t *slist);
H5_DLL herr_t H5SL_insert(H5SL_t *slist, void *item, const void *key);
H5_DLL H5SL_node_t *H5SL_add(H5SL_t *slist, void *item, const void *key);
@ -84,6 +83,7 @@ H5_DLL herr_t H5SL_release(H5SL_t *slist);
H5_DLL herr_t H5SL_free(H5SL_t *slist, H5SL_operator_t op, void *op_data);
H5_DLL herr_t H5SL_close(H5SL_t *slist);
H5_DLL herr_t H5SL_destroy(H5SL_t *slist, H5SL_operator_t op, void *op_data);
H5_DLL int H5SL_term_interface(void);
#endif /* _H5SLprivate_H */

View File

@ -121,7 +121,7 @@ test_skiplist_create(void)
MESSAGE(6, ("Testing Creating & Closing Skip Lists\n"));
/* Try creating a skip list */
slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16);
slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Try closing the skip list */
@ -151,7 +151,7 @@ test_skiplist_insert(void)
MESSAGE(7, ("Testing Insertion Into Skip List\n"));
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16);
slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Check that the skip list has no elements */
@ -212,7 +212,7 @@ test_skiplist_insert_many(void)
MESSAGE(7, ("Testing Insertion of Many Items Into Skip List\n"));
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16);
slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Check that the skip list has no elements */
@ -286,7 +286,7 @@ test_skiplist_remove(void)
MESSAGE(7, ("Testing Removal From Skip List\n"));
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16);
slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Check that the skip list has no elements */
@ -365,7 +365,7 @@ test_skiplist_remove_many(void)
MESSAGE(7, ("Testing Removal of Many Items From Skip List\n"));
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16);
slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Check that the skip list has no elements */
@ -465,7 +465,7 @@ test_skiplist_firstnext(void)
MESSAGE(7, ("Testing Iterating Over Skip List With First/Next\n"));
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16);
slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Check that the skip list has no elements */
@ -558,7 +558,7 @@ test_skiplist_string(void)
MESSAGE(7, ("Testing Skip List With String Keys\n"));
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_STR, 0.5, (size_t)16);
slist = H5SL_create(H5SL_TYPE_STR);
CHECK(slist, NULL, "H5SL_create");
/* Check that the skip list has no elements */
@ -620,7 +620,7 @@ test_skiplist_iterate(void)
MESSAGE(7, ("Testing Iterating Over Skip List\n"));
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16);
slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Check that the skip list has no elements */
@ -670,7 +670,7 @@ test_skiplist_hsize(void)
MESSAGE(7, ("Testing Skip List With hsize_t Keys\n"));
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_HSIZE, 0.5, (size_t)16);
slist = H5SL_create(H5SL_TYPE_HSIZE);
CHECK(slist, NULL, "H5SL_create");
/* Check that the skip list has no elements */
@ -725,7 +725,7 @@ test_skiplist_unsigned(void)
MESSAGE(7, ("Testing Skip List With unsigned Keys\n"));
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16);
slist = H5SL_create(H5SL_TYPE_UNSIGNED);
CHECK(slist, NULL, "H5SL_create");
/* Check that the skip list has no elements */
@ -778,7 +778,7 @@ test_skiplist_lastprev(void)
MESSAGE(7, ("Testing Iterating Over Skip List With Last/Prev\n"));
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16);
slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Check that the skip list has no elements */
@ -846,7 +846,7 @@ test_skiplist_find(void)
MESSAGE(7, ("Testing Skip List 'Find' Operation\n"));
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16);
slist = H5SL_create(H5SL_TYPE_UNSIGNED);
CHECK(slist, NULL, "H5SL_create");
/* Insert objects into the skip list */
@ -902,7 +902,7 @@ test_skiplist_add(void)
MESSAGE(7, ("Testing Skip List 'Add' Operation\n"));
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16);
slist = H5SL_create(H5SL_TYPE_UNSIGNED);
CHECK(slist, NULL, "H5SL_create");
/* Insert objects into the skip list */
@ -964,7 +964,7 @@ test_skiplist_destroy(void)
MESSAGE(7, ("Testing Skip List 'Destroy' Operation\n"));
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16);
slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Insert objects into the skip list */
@ -1000,7 +1000,7 @@ test_skiplist_free(void)
MESSAGE(7, ("Testing Skip List 'Free' Operation\n"));
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_INT, 0.5, (size_t)16);
slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Insert objects into the skip list */
@ -1056,7 +1056,7 @@ test_skiplist_less(void)
MESSAGE(7, ("Testing Skip List 'Less' Operation\n"));
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16);
slist = H5SL_create(H5SL_TYPE_UNSIGNED);
CHECK(slist, NULL, "H5SL_create");
/* Insert objects into the skip list */
@ -1120,7 +1120,7 @@ test_skiplist_greater(void)
MESSAGE(7, ("Testing Skip List 'Greater' Operation\n"));
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16);
slist = H5SL_create(H5SL_TYPE_UNSIGNED);
CHECK(slist, NULL, "H5SL_create");
/* Insert objects into the skip list */
@ -1182,10 +1182,10 @@ test_skiplist_below(void)
herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Skip List 'Less' Operation\n"));
MESSAGE(7, ("Testing Skip List 'Below' Operation\n"));
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16);
slist = H5SL_create(H5SL_TYPE_UNSIGNED);
CHECK(slist, NULL, "H5SL_create");
/* Insert objects into the skip list */
@ -1261,10 +1261,10 @@ test_skiplist_above(void)
herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Skip List 'Greater' Operation\n"));
MESSAGE(7, ("Testing Skip List 'Above' Operation\n"));
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16);
slist = H5SL_create(H5SL_TYPE_UNSIGNED);
CHECK(slist, NULL, "H5SL_create");
/* Insert objects into the skip list */
@ -1338,10 +1338,10 @@ test_skiplist_remove_first(void)
herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Skip List 'Greater' Operation\n"));
MESSAGE(7, ("Testing Skip List 'Remove First' Operation\n"));
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_UNSIGNED, 0.5, (size_t)16);
slist = H5SL_create(H5SL_TYPE_UNSIGNED);
CHECK(slist, NULL, "H5SL_create");
/* Insert objects into the skip list */
@ -1366,6 +1366,51 @@ test_skiplist_remove_first(void)
} /* end test_skiplist_remove_first() */
/****************************************************************
**
** test_skiplist_remote_first_many(): Test H5SL (skip list) code.
** Tests 'remove first' operation in large skip lists.
**
****************************************************************/
static void
test_skiplist_remove_first_many(void)
{
H5SL_t *slist; /* Skip list created */
size_t u; /* Local index variable */
int *found_item; /* Item found in skip list */
int prev_item = INT_MIN; /* Previously found item in skip list */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(7, ("Testing Skip List 'Remove First' Operation\n"));
/* Create a skip list */
slist = H5SL_create(H5SL_TYPE_INT);
CHECK(slist, NULL, "H5SL_create");
/* Insert objects into the skip list */
for(u = 0; u < NUM_ELEMS; u++) {
ret = H5SL_insert(slist, &rand_num[u], &rand_num[u]);
CHECK(ret, FAIL, "H5SL_insert");
} /* end for */
/* Remove objects from the skip list */
for(u = 0; u < NUM_ELEMS; u++) {
found_item = (int *)H5SL_remove_first(slist);
VERIFY(*found_item > prev_item, TRUE, "H5SL_remove_first");
prev_item = *found_item;
} /* end for */
/* Check for removing object from empty list */
found_item = (int *)H5SL_remove_first(slist);
VERIFY(found_item, NULL, "H5SL_remove_first");
/* Close the skip list */
ret = H5SL_close(slist);
CHECK(ret, FAIL, "H5SL_close");
} /* end test_skiplist_remove_first() */
/****************************************************************
**
** test_skiplist(): Main H5SL testing routine.
@ -1401,6 +1446,7 @@ test_skiplist(void)
test_skiplist_below(); /* Test 'below' operation */
test_skiplist_above(); /* Test 'above' operation */
test_skiplist_remove_first(); /* Test 'remove first' operation */
test_skiplist_remove_first_many(); /* Test 'remove first' operation on large skip lists */
} /* end test_skiplist() */

View File

@ -117,7 +117,7 @@ init_ref_path_table(void)
HDassert(thefile > 0);
/* Create skip list to store reference path information */
if((ref_path_table = H5SL_create(H5SL_TYPE_HADDR, 0.5, (size_t)16))==NULL)
if((ref_path_table = H5SL_create(H5SL_TYPE_HADDR))==NULL)
return (-1);
/* Iterate over objects in this file */