summaryrefslogtreecommitdiffstats
path: root/src/H5Dfill.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2016-07-18 00:18:42 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2016-07-18 00:18:42 (GMT)
commitbb19817c9fd5d46cdc1ab5a396f38f0561dfa167 (patch)
tree69498cabeabf6f68faa23b835e24cb7ef4f80563 /src/H5Dfill.c
parentc8f4641507bf4ca85c70c39c786c07f8ef4a24ed (diff)
downloadhdf5-bb19817c9fd5d46cdc1ab5a396f38f0561dfa167.zip
hdf5-bb19817c9fd5d46cdc1ab5a396f38f0561dfa167.tar.gz
hdf5-bb19817c9fd5d46cdc1ab5a396f38f0561dfa167.tar.bz2
[svn-r30189] Description:
Clean up more warnings: drop the warning count from ~1310 down to ~940, with only 31 types of warnings in 148 files (down from 38 types in 167 files). Tested on: MacOSX/64 10.11.5 (amazon) w/serial & parallel (h5committest forthcoming)
Diffstat (limited to 'src/H5Dfill.c')
-rw-r--r--src/H5Dfill.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/H5Dfill.c b/src/H5Dfill.c
index e5b2161..50c964b 100644
--- a/src/H5Dfill.c
+++ b/src/H5Dfill.c
@@ -88,6 +88,9 @@ H5FL_BLK_DEFINE_STATIC(non_zero_fill);
/* Declare the free list to manage blocks of zero fill-value data */
H5FL_BLK_DEFINE_STATIC(zero_fill);
+/* Declare extern free list to manage the H5S_sel_iter_t struct */
+H5FL_EXTERN(H5S_sel_iter_t);
+
/*--------------------------------------------------------------------------
NAME
@@ -174,6 +177,8 @@ herr_t
H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
const H5T_t *buf_type, const H5S_t *space, hid_t dxpl_id)
{
+ H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */
+ hbool_t mem_iter_init = FALSE; /* Whether the memory selection iterator has been initialized */
H5WB_t *elem_wb = NULL; /* Wrapped buffer for element data */
uint8_t elem_buf[H5T_ELEM_BUF_SIZE]; /* Buffer for element data */
H5WB_t *bkg_elem_wb = NULL; /* Wrapped buffer for background data */
@@ -246,7 +251,6 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
if(TRUE == H5T_detect_class(fill_type, H5T_VLEN, FALSE)) {
H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */
H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */
- H5S_sel_iter_t mem_iter; /* Memory selection iteration info */
hssize_t nelmts; /* Number of data elements */
/* Get the number of elements in the selection */
@@ -273,19 +277,18 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache")
+ /* Allocate the chunk selection iterator */
+ if(NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory selection iterator")
+
/* Create a selection iterator for scattering the elements to memory buffer */
- if(H5S_select_iter_init(&mem_iter, space, dst_type_size) < 0)
+ if(H5S_select_iter_init(mem_iter, space, dst_type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
+ mem_iter_init = TRUE;
/* Scatter the data into memory */
- if(H5D__scatter_mem(tmp_buf, space, &mem_iter, (size_t)nelmts, dxpl_cache, buf/*out*/) < 0) {
- H5S_SELECT_ITER_RELEASE(&mem_iter);
+ if(H5D__scatter_mem(tmp_buf, space, mem_iter, (size_t)nelmts, dxpl_cache, buf/*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
- } /* end if */
-
- /* Release the selection iterator */
- if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
else {
const uint8_t *fill_buf; /* Buffer to use for writing fill values */
@@ -335,6 +338,10 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
} /* end else */
done:
+ if(mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(mem_iter)
+ mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter);
if(src_id != (-1) && H5I_dec_ref(src_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
if(dst_id != (-1) && H5I_dec_ref(dst_id) < 0)