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/H5FL.c | |
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/H5FL.c')
-rw-r--r-- | src/H5FL.c | 32 |
1 files changed, 30 insertions, 2 deletions
@@ -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 */ |