diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2000-04-14 19:07:32 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2000-04-14 19:07:32 (GMT) |
commit | bb12f5d5d2e76bad01222f214a8e492e6f13e07b (patch) | |
tree | c49420fb1d15712fd6c0e1005968692e20e72e9a /src | |
parent | 0a77488511419bb82b7901bd63d8fdc2a0a4ec9b (diff) | |
download | hdf5-bb12f5d5d2e76bad01222f214a8e492e6f13e07b.zip hdf5-bb12f5d5d2e76bad01222f214a8e492e6f13e07b.tar.gz hdf5-bb12f5d5d2e76bad01222f214a8e492e6f13e07b.tar.bz2 |
[svn-r2147] Corrected a few problems in the free-list code and added more assert() macros
to double-check things. I've turned them back on again now. I also changed
the internal representation of a few struct fields to be float instead of
double, since the HP/UX 10.20 compiler was having problems with the alignment
of the doubles.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5B.c | 16 | ||||
-rw-r--r-- | src/H5Bprivate.h | 2 | ||||
-rw-r--r-- | src/H5Distore.c | 2 | ||||
-rw-r--r-- | src/H5FL.c | 32 | ||||
-rw-r--r-- | src/H5Fistore.c | 2 | ||||
-rw-r--r-- | src/H5Fprivate.h | 6 | ||||
-rw-r--r-- | src/H5Gstab.c | 2 | ||||
-rw-r--r-- | src/H5Spoint.c | 2 |
8 files changed, 47 insertions, 17 deletions
@@ -106,7 +106,7 @@ /* PRIVATE PROTOTYPES */ static H5B_ins_t H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, - const double split_ratios[], + const float split_ratios[], uint8_t *lt_key, hbool_t *lt_key_changed, uint8_t *md_key, void *udata, @@ -124,7 +124,7 @@ static size_t H5B_nodesize(H5F_t *f, const H5B_class_t *type, size_t *total_nkey_size, size_t sizeof_rkey); static herr_t H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt, haddr_t old_addr, intn idx, - const double split_ratios[], void *udata, + const float split_ratios[], void *udata, haddr_t *new_addr/*out*/); #ifdef H5B_DEBUG static herr_t H5B_assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, @@ -628,7 +628,7 @@ H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) */ static herr_t H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt, haddr_t old_addr, - intn idx, const double split_ratios[], void *udata, + intn idx, const float split_ratios[], void *udata, haddr_t *new_addr_p/*out*/) { H5B_t *new_bt = NULL, *tmp_bt = NULL; @@ -865,7 +865,7 @@ H5B_decode_keys(H5F_t *f, H5B_t *bt, intn idx) */ herr_t H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, - const double split_ratios[], void *udata) + const float split_ratios[], void *udata) { /* * These are defined this way to satisfy alignment constraints. @@ -1160,7 +1160,7 @@ H5B_insert_child(H5F_t *f, const H5B_class_t *type, H5B_t *bt, */ static H5B_ins_t H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, - const double split_ratios[], uint8_t *lt_key, + const float split_ratios[], uint8_t *lt_key, hbool_t *lt_key_changed, uint8_t *md_key, void *udata, uint8_t *rt_key, hbool_t *rt_key_changed, haddr_t *new_node_p/*out*/) @@ -1604,8 +1604,10 @@ H5B_iterate (H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) } done: - H5FL_ARR_FREE(haddr_t,child); - H5MM_xfree(key); + if(child!=NULL) + H5FL_ARR_FREE(haddr_t,child); + if(key!=NULL) + H5MM_xfree(key); FUNC_LEAVE(ret_value); } diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h index cb60768..01f94c4 100644 --- a/src/H5Bprivate.h +++ b/src/H5Bprivate.h @@ -131,7 +131,7 @@ __DLL__ herr_t H5B_create (H5F_t *f, const H5B_class_t *type, void *udata, __DLL__ herr_t H5B_find (H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata); __DLL__ herr_t H5B_insert (H5F_t *f, const H5B_class_t *type, haddr_t addr, - const double split_ratios[], void *udata); + const float split_ratios[], void *udata); __DLL__ herr_t H5B_remove(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata); __DLL__ herr_t H5B_iterate (H5F_t *f, const H5B_class_t *type, haddr_t addr, diff --git a/src/H5Distore.c b/src/H5Distore.c index c4728ad..8339e30 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -85,7 +85,7 @@ typedef struct H5F_rdcc_ent_t { hbool_t locked; /*entry is locked in cache */ hbool_t dirty; /*needs to be written to disk? */ H5O_layout_t *layout; /*the layout message */ - double split_ratios[3];/*B-tree node splitting ratios */ + float split_ratios[3];/*B-tree node splitting ratios */ H5O_pline_t *pline; /*filter pipeline message */ hssize_t offset[H5O_LAYOUT_NDIMS]; /*chunk name */ size_t rd_count; /*bytes remaining to be read */ @@ -58,7 +58,7 @@ static H5FL_gc_list_t *H5FL_gc_head=NULL; static H5FL_gc_arr_list_t *H5FL_gc_arr_head=NULL; /* Macros for turning off free lists in the library */ -#define NO_FREE_LISTS +/* #define NO_FREE_LISTS */ #ifdef NO_FREE_LISTS #define NO_REG_FREE_LISTS #define NO_ARR_FREE_LISTS @@ -130,10 +130,15 @@ H5FL_free(H5FL_head_t *head, void *obj) FUNC_ENTER (H5FL_free, NULL); -#ifdef NO_REG_FREE_LISTS + /* Double check parameters */ + assert(head); + assert(obj); + #ifdef H5FL_DEBUG HDmemset(obj,255,head->size); #endif /* H5FL_DEBUG */ + +#ifdef NO_REG_FREE_LISTS H5MM_xfree(obj); #else /* NO_REG_FREE_LISTS */ /* Make certain that the free list is initialized */ @@ -184,6 +189,9 @@ H5FL_alloc(H5FL_head_t *head, uintn clear) FUNC_ENTER (H5FL_alloc, NULL); + /* Double check parameters */ + assert(head); + #ifdef NO_REG_FREE_LISTS if(clear) ret_value=H5MM_calloc(head->size); @@ -531,6 +539,9 @@ H5FL_blk_alloc(H5FL_blk_head_t *head, size_t size, uintn clear) FUNC_ENTER(H5FL_blk_alloc, NULL); + /* Double check parameters */ + assert(head); + #ifdef NO_BLK_FREE_LISTS if(clear) ret_value=H5MM_calloc(size); @@ -604,6 +615,10 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) FUNC_ENTER(H5FL_blk_free, NULL); + /* Double check parameters */ + assert(head); + assert(block); + #ifdef NO_BLK_FREE_LISTS H5MM_xfree(block); #else /* NO_BLK_FREE_LISTS */ @@ -655,6 +670,9 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size) FUNC_ENTER(H5FL_blk_realloc, NULL); + /* Double check parameters */ + assert(head); + #ifdef NO_BLK_FREE_LISTS ret_value=H5MM_realloc(block,new_size); #else /* NO_BLK_FREE_LISTS */ @@ -917,6 +935,10 @@ H5FL_arr_free(H5FL_arr_head_t *head, void *obj) FUNC_ENTER (H5FL_arr_free, NULL); + /* Double check parameters */ + assert(head); + assert(obj); + #ifdef NO_ARR_FREE_LISTS H5MM_xfree(obj); #else /* NO_ARR_FREE_LISTS */ @@ -973,6 +995,9 @@ H5FL_arr_alloc(H5FL_arr_head_t *head, uintn elem, uintn clear) FUNC_ENTER (H5FL_arr_alloc, NULL); + /* Double check parameters */ + assert(head); + #ifdef NO_ARR_FREE_LISTS if(clear) ret_value=H5MM_calloc(elem*head->size); @@ -1049,6 +1074,9 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void * obj, uintn new_elem) FUNC_ENTER (H5FL_arr_realloc, NULL); + /* Double check parameters */ + assert(head); + #ifdef NO_ARR_FREE_LISTS ret_value=H5MM_realloc(obj,new_elem*head->size); #else /* NO_ARR_FREE_LISTS */ diff --git a/src/H5Fistore.c b/src/H5Fistore.c index c4728ad..8339e30 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -85,7 +85,7 @@ typedef struct H5F_rdcc_ent_t { hbool_t locked; /*entry is locked in cache */ hbool_t dirty; /*needs to be written to disk? */ H5O_layout_t *layout; /*the layout message */ - double split_ratios[3];/*B-tree node splitting ratios */ + float split_ratios[3];/*B-tree node splitting ratios */ H5O_pline_t *pline; /*filter pipeline message */ hssize_t offset[H5O_LAYOUT_NDIMS]; /*chunk name */ size_t rd_count; /*bytes remaining to be read */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index d9952a8..5acb280 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -251,7 +251,7 @@ typedef struct H5F_access_t { intn mdc_nelmts; /* Size of meta data cache (elements) */ intn rdcc_nelmts; /* Size of raw data chunk cache (elmts) */ size_t rdcc_nbytes; /* Size of raw data chunk cache (bytes) */ - double rdcc_w0; /* Preempt read chunks first? [0.0..1.0]*/ + float rdcc_w0; /* Preempt read chunks first? [0.0..1.0]*/ hsize_t threshold; /* Threshold for alignment */ hsize_t alignment; /* Alignment */ uintn gc_ref; /* Garbage-collect references? */ @@ -265,7 +265,7 @@ typedef struct H5F_xfer_t { void *tconv_buf; /*type conversion buffer or null */ void *bkg_buf; /*background buffer or null */ H5T_bkg_t need_bkg; /*type of background buffer needed */ - double split_ratios[3];/*B-tree node splitting ratios */ + float split_ratios[3];/*B-tree node splitting ratios */ uintn cache_hyper; /*cache hyperslab blocks during I/O? */ uintn block_limit; /*largest hyperslab block to cache */ H5MM_allocate_t vlen_alloc; /*VL datatype allocation function */ @@ -315,7 +315,7 @@ typedef struct H5F_file_t { intn mdc_nelmts; /* Size of meta data cache (elements) */ intn rdcc_nelmts; /* Size of raw data chunk cache (elmts) */ size_t rdcc_nbytes; /* Size of raw data chunk cache (bytes) */ - double rdcc_w0; /* Preempt read chunks first? [0.0..1.0]*/ + float rdcc_w0; /* Preempt read chunks first? [0.0..1.0]*/ hsize_t threshold; /* Threshold for alignment */ hsize_t alignment; /* Alignment */ uintn gc_ref; /* Garbage-collect references? */ diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 2b48712..26f1212 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -177,7 +177,7 @@ H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent) { H5O_stab_t stab; /*symbol table message */ H5G_bt_ud1_t udata; /*data to pass through B-tree */ - static double split_ratios[3] = {0.1, 0.5, 0.9}; + static float split_ratios[3] = {0.1, 0.5, 0.9}; FUNC_ENTER(H5G_stab_insert, FAIL); diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 6c47996..7cd56bf 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -1170,7 +1170,7 @@ H5S_point_select_contiguous(const H5S_t *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t H5S_select_elements (H5S_t *space, H5S_seloper_t op, size_t num_elem, +static herr_t H5S_select_elements (H5S_t *space, H5S_seloper_t op, size_t num_elem, const hssize_t **coord) { herr_t ret_value=SUCCEED; /* return value */ |