summaryrefslogtreecommitdiffstats
path: root/src/H5Dchunk.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2017-06-08 19:24:48 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2017-06-08 19:24:48 (GMT)
commit4242753848c44ab3b5d226e66225eac2f64db314 (patch)
tree6053b3f7deabf531b629a276fd9fb7fa1ad13f4b /src/H5Dchunk.c
parentb0e79fe6dd20ec7aa1b3e5f0f8b370639a4ef5bd (diff)
parentd391d8a690b4d595709e1274882fb5e5e0559f9e (diff)
downloadhdf5-4242753848c44ab3b5d226e66225eac2f64db314.zip
hdf5-4242753848c44ab3b5d226e66225eac2f64db314.tar.gz
hdf5-4242753848c44ab3b5d226e66225eac2f64db314.tar.bz2
Merge pull request #567 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:develop to develop
Makes all non-global H5O_layout_t structs dynamic (quiets stack warnings). * commit 'd391d8a690b4d595709e1274882fb5e5e0559f9e': * Made STATIC free lists EXTERN for H5O_layout_t. * Made all non-global instances of H5O_layout_t in H5Pdcpl.c dynamic. Updated H5O_layout_t dynamic work to use the H5FL interface. Made some H5O_layout_t stack allocations dynamic (quiets warnings).
Diffstat (limited to 'src/H5Dchunk.c')
-rw-r--r--src/H5Dchunk.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 33fc036..317039d 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -368,6 +368,9 @@ H5FL_BLK_DEFINE_STATIC(chunk);
/* Declare extern free list to manage the H5S_sel_iter_t struct */
H5FL_EXTERN(H5S_sel_iter_t);
+/* Declare a free list to manage the H5O_layout_t struct */
+H5FL_EXTERN(H5O_layout_t);
+
/*-------------------------------------------------------------------------
* Function: H5D__chunk_direct_write
@@ -5443,7 +5446,7 @@ herr_t
H5D__chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_storage_t *storage)
{
H5D_chk_idx_info_t idx_info; /* Chunked index info */
- H5O_layout_t layout; /* Dataset layout message */
+ H5O_layout_t *layout = NULL; /* Dataset layout message */
hbool_t layout_read = FALSE; /* Whether the layout message was read from the file */
H5O_pline_t pline; /* I/O pipeline message */
hbool_t pline_read = FALSE; /* Whether the I/O pipeline message was read from the file */
@@ -5474,7 +5477,9 @@ H5D__chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_storage_t *storage)
if((exists = H5O_msg_exists_oh(oh, H5O_LAYOUT_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to check for object header message")
else if(exists) {
- if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_LAYOUT_ID, &layout))
+ if(NULL == (layout = H5FL_CALLOC(H5O_layout_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for layout")
+ if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_LAYOUT_ID, layout))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get layout message")
layout_read = TRUE;
} /* end else if */
@@ -5485,7 +5490,7 @@ H5D__chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_storage_t *storage)
idx_info.f = f;
idx_info.dxpl_id = dxpl_id;
idx_info.pline = &pline;
- idx_info.layout = &layout.u.chunk;
+ idx_info.layout = &layout->u.chunk;
idx_info.storage = &storage->u.chunk;
/* Delete the chunked storage information in the file */
@@ -5498,9 +5503,12 @@ done:
if(H5O_msg_reset(H5O_PLINE_ID, &pline) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset I/O pipeline message")
if(layout_read)
- if(H5O_msg_reset(H5O_LAYOUT_ID, &layout) < 0)
+ if(H5O_msg_reset(H5O_LAYOUT_ID, layout) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset layout message")
+ if(layout)
+ layout = H5FL_FREE(H5O_layout_t, layout);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_delete() */