diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2000-04-14 19:08:58 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2000-04-14 19:08:58 (GMT) |
commit | 5cef4102cd9747f5e049f73861c0dc090e0bd4a0 (patch) | |
tree | 1e8e4f550c1bcc9f90ed3746e237d96d57568b66 /src | |
parent | e4579cb7254f035f4d9e70e7229b459aad5915c1 (diff) | |
download | hdf5-5cef4102cd9747f5e049f73861c0dc090e0bd4a0.zip hdf5-5cef4102cd9747f5e049f73861c0dc090e0bd4a0.tar.gz hdf5-5cef4102cd9747f5e049f73861c0dc090e0bd4a0.tar.bz2 |
[svn-r2148] 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 | 18 | ||||
-rw-r--r-- | src/H5Bprivate.h | 2 | ||||
-rw-r--r-- | src/H5Distore.c | 8 | ||||
-rw-r--r-- | src/H5FL.c | 32 | ||||
-rw-r--r-- | src/H5Fistore.c | 8 | ||||
-rw-r--r-- | src/H5Fprivate.h | 6 | ||||
-rw-r--r-- | src/H5Gstab.c | 2 |
7 files changed, 53 insertions, 23 deletions
@@ -103,7 +103,7 @@ /* PRIVATE PROTOTYPES */ static H5B_ins_t H5B_insert_helper(H5F_t *f, const 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, const 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, const haddr_t *addr, @@ -617,7 +617,7 @@ H5B_find(H5F_t *f, const H5B_class_t *type, const haddr_t *addr, void *udata) */ static herr_t H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt, - const haddr_t *old_addr, intn idx, const double split_ratios[], + const haddr_t *old_addr, intn idx, const float split_ratios[], void *udata, haddr_t *new_addr/*out*/) { H5B_t *new_bt = NULL, *tmp_bt = NULL; @@ -853,7 +853,7 @@ H5B_decode_keys(H5F_t *f, H5B_t *bt, intn idx) */ herr_t H5B_insert(H5F_t *f, const H5B_class_t *type, const haddr_t *addr, - const double split_ratios[], void *udata) + const float split_ratios[], void *udata) { /* * These are defined this way to satisfy alignment constraints. @@ -1146,7 +1146,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, const 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/*out*/) @@ -1588,9 +1588,11 @@ H5B_iterate (H5F_t *f, const H5B_class_t *type, const haddr_t *addr, } } - done: - H5FL_ARR_FREE(haddr_t,child); - H5MM_xfree(key); +done: + 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 e0d7e8e..cc95123 100644 --- a/src/H5Bprivate.h +++ b/src/H5Bprivate.h @@ -132,7 +132,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, const haddr_t *addr, void *udata); __DLL__ herr_t H5B_insert (H5F_t *f, const H5B_class_t *type, - const haddr_t *addr, const double split_ratios[], + const haddr_t *addr, const float split_ratios[], void *udata); __DLL__ herr_t H5B_remove(H5F_t *f, const H5B_class_t *type, const haddr_t *addr, void *udata); diff --git a/src/H5Distore.c b/src/H5Distore.c index 428b679..a088560 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -80,7 +80,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 */ @@ -1316,7 +1316,7 @@ H5F_istore_prune (H5F_t *f, size_t size) */ static void * H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout, - const double split_ratios[], const H5O_pline_t *pline, + const float split_ratios[], const H5O_pline_t *pline, const H5O_fill_t *fill, const hssize_t offset[], hbool_t relax, intn *idx_hint/*in,out*/) { @@ -1587,7 +1587,7 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout, */ static herr_t H5F_istore_unlock (H5F_t *f, const H5O_layout_t *layout, - const double split_ratios[], + const float split_ratios[], const H5O_pline_t *pline, hbool_t dirty, const hssize_t offset[], intn *idx_hint, uint8_t *chunk, size_t naccessed) @@ -2289,7 +2289,7 @@ H5F_istore_get_addr(H5F_t *f, const H5O_layout_t *layout, */ herr_t H5F_istore_allocate (H5F_t *f, const H5O_layout_t *layout, - const hsize_t *space_dim, const double split_ratios[], + const hsize_t *space_dim, const float split_ratios[], const H5O_pline_t *pline, const H5O_fill_t *fill) { @@ -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 428b679..a088560 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -80,7 +80,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 */ @@ -1316,7 +1316,7 @@ H5F_istore_prune (H5F_t *f, size_t size) */ static void * H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout, - const double split_ratios[], const H5O_pline_t *pline, + const float split_ratios[], const H5O_pline_t *pline, const H5O_fill_t *fill, const hssize_t offset[], hbool_t relax, intn *idx_hint/*in,out*/) { @@ -1587,7 +1587,7 @@ H5F_istore_lock (H5F_t *f, const H5O_layout_t *layout, */ static herr_t H5F_istore_unlock (H5F_t *f, const H5O_layout_t *layout, - const double split_ratios[], + const float split_ratios[], const H5O_pline_t *pline, hbool_t dirty, const hssize_t offset[], intn *idx_hint, uint8_t *chunk, size_t naccessed) @@ -2289,7 +2289,7 @@ H5F_istore_get_addr(H5F_t *f, const H5O_layout_t *layout, */ herr_t H5F_istore_allocate (H5F_t *f, const H5O_layout_t *layout, - const hsize_t *space_dim, const double split_ratios[], + const hsize_t *space_dim, const float split_ratios[], const H5O_pline_t *pline, const H5O_fill_t *fill) { diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 1b0f253..2715140 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -253,7 +253,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? */ @@ -339,7 +339,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 */ H5D_transfer_t xfer_mode; /*independent or collective transfer */ @@ -661,7 +661,7 @@ __DLL__ herr_t H5F_istore_write(H5F_t *f, const struct H5F_xfer_t *xfer, __DLL__ herr_t H5F_istore_allocate (H5F_t *f, const struct H5O_layout_t *layout, const hsize_t *space_dim, - const double split_ratios[], + const float split_ratios[], const struct H5O_pline_t *pline, const struct H5O_fill_t *fill); __DLL__ herr_t H5F_istore_dump_btree(H5F_t *f, FILE *stream, int ndims, diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 773c564..8843de6 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); |