summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2017-06-10 04:04:03 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2017-06-10 04:04:03 (GMT)
commit7a25041caf6dced2ad2480bb39eb2bc98721e51f (patch)
treecbaf52a8a57f0fb6ad45c74b3193e6ee55ecbc78
parenteaedb70001536ae6c2a7f753c3a358f0e8ce5011 (diff)
parent005bf26ff83fcd28255a77fb9bbb4a64495cb4a2 (diff)
downloadhdf5-7a25041caf6dced2ad2480bb39eb2bc98721e51f.zip
hdf5-7a25041caf6dced2ad2480bb39eb2bc98721e51f.tar.gz
hdf5-7a25041caf6dced2ad2480bb39eb2bc98721e51f.tar.bz2
Merge pull request #572 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:develop to develop
* commit '005bf26ff83fcd28255a77fb9bbb4a64495cb4a2': Revert "Merge pull request #567 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:develop to develop"
-rw-r--r--src/H5Dchunk.c16
-rw-r--r--src/H5Dearray.c16
-rw-r--r--src/H5Dfarray.c14
-rw-r--r--src/H5Dint.c40
-rw-r--r--src/H5Doh.c46
-rw-r--r--src/H5Omessage.c10
-rw-r--r--src/H5Pdcpl.c409
-rw-r--r--src/H5Z.c74
8 files changed, 230 insertions, 395 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 317039d..33fc036 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -368,9 +368,6 @@ 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
@@ -5446,7 +5443,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 = NULL; /* Dataset layout message */
+ H5O_layout_t layout; /* 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 */
@@ -5477,9 +5474,7 @@ 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 == (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))
+ 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 */
@@ -5490,7 +5485,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 */
@@ -5503,12 +5498,9 @@ 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() */
diff --git a/src/H5Dearray.c b/src/H5Dearray.c
index a45d546..1df0a58 100644
--- a/src/H5Dearray.c
+++ b/src/H5Dearray.c
@@ -214,13 +214,10 @@ const H5EA_class_t H5EA_CLS_FILT_CHUNK[1]={{
/*******************/
/* Declare a free list to manage the H5D_earray_ctx_t struct */
-H5FL_DEFINE_STATIC(H5D_earray_ctx_t);
-
/* Declare a free list to manage the H5D_earray_ctx_ud_t struct */
+H5FL_DEFINE_STATIC(H5D_earray_ctx_t);
H5FL_DEFINE_STATIC(H5D_earray_ctx_ud_t);
-/* Declare a free list to manage the H5O_layout_t struct */
-H5FL_EXTERN(H5O_layout_t);
/*-------------------------------------------------------------------------
@@ -632,7 +629,7 @@ H5D__earray_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr)
H5D_earray_ctx_ud_t *dbg_ctx = NULL; /* Context for fixed array callback */
H5O_loc_t obj_loc; /* Pointer to an object's location */
hbool_t obj_opened = FALSE; /* Flag to indicate that the object header was opened */
- H5O_layout_t *layout = NULL; /* Layout message */
+ H5O_layout_t layout; /* Layout message */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -656,9 +653,7 @@ H5D__earray_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr)
obj_opened = TRUE;
/* Read the layout message */
- if(NULL == (layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't get memory for layout")
- if(NULL == H5O_msg_read(&obj_loc, H5O_LAYOUT_ID, layout, dxpl_id))
+ if(NULL == H5O_msg_read(&obj_loc, H5O_LAYOUT_ID, &layout, dxpl_id))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get layout info")
/* close the object header */
@@ -667,7 +662,7 @@ H5D__earray_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr)
/* Create user data */
dbg_ctx->f = f;
- dbg_ctx->chunk_size = layout->u.chunk.size;
+ dbg_ctx->chunk_size = layout.u.chunk.size;
/* Set return value */
ret_value = dbg_ctx;
@@ -686,9 +681,6 @@ done:
} /* end if */
} /* end if */
- if(layout)
- layout = H5FL_FREE(H5O_layout_t, layout);
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__earray_crt_dbg_context() */
diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c
index 486fb54..d183a8c 100644
--- a/src/H5Dfarray.c
+++ b/src/H5Dfarray.c
@@ -217,9 +217,6 @@ H5FL_DEFINE_STATIC(H5D_farray_ctx_t);
/* Declare a free list to manage the H5D_farray_ctx_ud_t struct */
H5FL_DEFINE_STATIC(H5D_farray_ctx_ud_t);
-/* Declare a free list to manage the H5O_layout_t struct */
-H5FL_EXTERN(H5O_layout_t);
-
/*-------------------------------------------------------------------------
* Function: H5D__farray_crt_context
@@ -472,7 +469,7 @@ H5D__farray_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr)
H5D_farray_ctx_ud_t *dbg_ctx = NULL; /* Context for fixed array callback */
H5O_loc_t obj_loc; /* Pointer to an object's location */
hbool_t obj_opened = FALSE; /* Flag to indicate that the object header was opened */
- H5O_layout_t *layout = NULL; /* Layout message */
+ H5O_layout_t layout; /* Layout message */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -496,9 +493,7 @@ H5D__farray_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr)
obj_opened = TRUE;
/* Read the layout message */
- if(NULL == (layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't get memory for layout")
- if(NULL == H5O_msg_read(&obj_loc, H5O_LAYOUT_ID, layout, dxpl_id))
+ if(NULL == H5O_msg_read(&obj_loc, H5O_LAYOUT_ID, &layout, dxpl_id))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get layout info")
/* close the object header */
@@ -507,7 +502,7 @@ H5D__farray_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr)
/* Create user data */
dbg_ctx->f = f;
- dbg_ctx->chunk_size = layout->u.chunk.size;
+ dbg_ctx->chunk_size = layout.u.chunk.size;
/* Set return value */
ret_value = dbg_ctx;
@@ -526,9 +521,6 @@ done:
} /* end if */
} /* end if */
- if(layout)
- layout = H5FL_FREE(H5O_layout_t, layout);
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__farray_crt_dbg_context() */
diff --git a/src/H5Dint.c b/src/H5Dint.c
index c13a7a1..08b3eb8 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -104,9 +104,6 @@ H5FL_EXTERN(H5D_chunk_info_t);
/* Declare extern the free list to manage blocks of type conversion data */
H5FL_BLK_EXTERN(type_conv);
-/* Declare a free list to manage the H5O_layout_t struct */
-H5FL_EXTERN(H5O_layout_t);
-
/* Define a static "default" dataset structure to use to initialize new datasets */
static H5D_shared_t H5D_def_dset;
@@ -3305,7 +3302,7 @@ H5D_get_create_plist(H5D_t *dset)
{
H5P_genplist_t *dcpl_plist; /* Dataset's DCPL */
H5P_genplist_t *new_plist; /* Copy of dataset's DCPL */
- H5O_layout_t *copied_layout = NULL; /* Layout to tweak */
+ H5O_layout_t copied_layout; /* Layout to tweak */
H5O_fill_t copied_fill; /* Fill value to tweak */
H5O_efl_t copied_efl; /* External file list to tweak */
hid_t new_dcpl_id = FAIL;
@@ -3328,41 +3325,39 @@ H5D_get_create_plist(H5D_t *dset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object creation info")
/* Get the layout property */
- if(NULL == (copied_layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for layout")
- if(H5P_peek(new_plist, H5D_CRT_LAYOUT_NAME, copied_layout) < 0)
+ if(H5P_peek(new_plist, H5D_CRT_LAYOUT_NAME, &copied_layout) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get layout")
/* Reset layout values set when dataset is created */
- copied_layout->ops = NULL;
- switch(copied_layout->type) {
+ copied_layout.ops = NULL;
+ switch(copied_layout.type) {
case H5D_COMPACT:
- copied_layout->storage.u.compact.buf = H5MM_xfree(copied_layout->storage.u.compact.buf);
- HDmemset(&copied_layout->storage.u.compact, 0, sizeof(copied_layout->storage.u.compact));
+ copied_layout.storage.u.compact.buf = H5MM_xfree(copied_layout.storage.u.compact.buf);
+ HDmemset(&copied_layout.storage.u.compact, 0, sizeof(copied_layout.storage.u.compact));
break;
case H5D_CONTIGUOUS:
- copied_layout->storage.u.contig.addr = HADDR_UNDEF;
- copied_layout->storage.u.contig.size = 0;
+ copied_layout.storage.u.contig.addr = HADDR_UNDEF;
+ copied_layout.storage.u.contig.size = 0;
break;
case H5D_CHUNKED:
/* Reset chunk size */
- copied_layout->u.chunk.size = 0;
+ copied_layout.u.chunk.size = 0;
/* Reset index info, if the chunk ops are set */
- if(copied_layout->storage.u.chunk.ops)
- /* Reset address and pointer of the array struct for the chunked storage index */
- if(H5D_chunk_idx_reset(&copied_layout->storage.u.chunk, TRUE) < 0)
+ if(copied_layout.storage.u.chunk.ops)
+ /* Reset address and pointer of the array struct for the chunked storage index */
+ if(H5D_chunk_idx_reset(&copied_layout.storage.u.chunk, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index in dest")
/* Reset chunk index ops */
- copied_layout->storage.u.chunk.ops = NULL;
+ copied_layout.storage.u.chunk.ops = NULL;
break;
case H5D_VIRTUAL:
- copied_layout->storage.u.virt.serial_list_hobjid.addr = HADDR_UNDEF;
- copied_layout->storage.u.virt.serial_list_hobjid.idx = 0;
+ copied_layout.storage.u.virt.serial_list_hobjid.addr = HADDR_UNDEF;
+ copied_layout.storage.u.virt.serial_list_hobjid.idx = 0;
break;
case H5D_LAYOUT_ERROR:
@@ -3372,7 +3367,7 @@ H5D_get_create_plist(H5D_t *dset)
} /* end switch */
/* Set back the (possibly modified) layout property to property list */
- if(H5P_poke(new_plist, H5D_CRT_LAYOUT_NAME, copied_layout) < 0)
+ if(H5P_poke(new_plist, H5D_CRT_LAYOUT_NAME, &copied_layout) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set layout")
/* Get the fill value property */
@@ -3464,9 +3459,6 @@ done:
if(H5I_dec_app_ref(new_dcpl_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to close temporary object")
- if(copied_layout)
- copied_layout = H5FL_FREE(H5O_layout_t, copied_layout);
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_get_create_plist() */
diff --git a/src/H5Doh.c b/src/H5Doh.c
index b371519..9abbdff 100644
--- a/src/H5Doh.c
+++ b/src/H5Doh.c
@@ -87,9 +87,6 @@ const H5O_obj_class_t H5O_OBJ_DATASET[1] = {{
/* Declare a free list to manage the H5D_copy_file_ud_t struct */
H5FL_DEFINE(H5D_copy_file_ud_t);
-/* Declare a free list to manage the H5O_layout_t struct */
-H5FL_EXTERN(H5O_layout_t);
-
/*-------------------------------------------------------------------------
* Function: H5O__dset_get_copy_file_udata
@@ -362,12 +359,12 @@ done:
static herr_t
H5O__dset_bh_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
{
- H5O_layout_t *layout = NULL; /* Data storage layout message */
- H5O_efl_t efl; /* External File List message */
+ H5O_layout_t layout; /* Data storage layout message */
+ H5O_efl_t efl; /* External File List message */
hbool_t layout_read = FALSE; /* Whether the layout message was read */
hbool_t efl_read = FALSE; /* Whether the external file list message was read */
- htri_t exists; /* Flag if header message of interest exists */
- herr_t ret_value = SUCCEED; /* Return value */
+ htri_t exists; /* Flag if header message of interest exists */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -379,24 +376,22 @@ H5O__dset_bh_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *
HDassert(bh_info);
/* Get the layout message from the object header */
- 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(loc->file, dxpl_id, oh, H5O_LAYOUT_ID, layout))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find layout message")
+ if(NULL == H5O_msg_read_oh(loc->file, dxpl_id, oh, H5O_LAYOUT_ID, &layout))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find layout message")
layout_read = TRUE;
/* Check for chunked dataset storage */
- if(layout->type == H5D_CHUNKED && H5D__chunk_is_space_alloc(&(layout->storage))) {
+ if(layout.type == H5D_CHUNKED && H5D__chunk_is_space_alloc(&layout.storage)) {
/* Get size of chunk index */
- if(H5D__chunk_bh_info(loc, dxpl_id, oh, layout, &(bh_info->index_size)) < 0)
+ if(H5D__chunk_bh_info(loc, dxpl_id, oh, &layout, &(bh_info->index_size)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine chunked dataset btree info")
} /* end if */
- else if(layout->type == H5D_VIRTUAL
- && (layout->storage.u.virt.serial_list_hobjid.addr != HADDR_UNDEF)) {
+ else if(layout.type == H5D_VIRTUAL
+ && (layout.storage.u.virt.serial_list_hobjid.addr != HADDR_UNDEF)) {
size_t virtual_heap_size;
/* Get size of global heap object for virtual dataset */
- if(H5HG_get_obj_size(loc->file, dxpl_id, &(layout->storage.u.virt.serial_list_hobjid), &virtual_heap_size) < 0)
+ if(H5HG_get_obj_size(loc->file, dxpl_id, &(layout.storage.u.virt.serial_list_hobjid), &virtual_heap_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get global heap size for virtual dataset mapping")
/* Return heap size */
@@ -405,32 +400,29 @@ H5O__dset_bh_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *
/* Check for External File List message in the object header */
if((exists = H5O_msg_exists_oh(oh, H5O_EFL_ID)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for EFL message")
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for EFL message")
- if(exists && H5D__efl_is_space_alloc(&(layout->storage))) {
+ if(exists && H5D__efl_is_space_alloc(&layout.storage)) {
/* Start with clean EFL info */
HDmemset(&efl, 0, sizeof(efl));
- /* Get External File List message from the object header */
- if(NULL == H5O_msg_read_oh(loc->file, dxpl_id, oh, H5O_EFL_ID, &efl))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find EFL message")
+ /* Get External File List message from the object header */
+ if(NULL == H5O_msg_read_oh(loc->file, dxpl_id, oh, H5O_EFL_ID, &efl))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find EFL message")
efl_read = TRUE;
- /* Get size of local heap for EFL message's file list */
- if(H5D__efl_bh_info(loc->file, dxpl_id, &efl, &(bh_info->heap_size)) < 0)
+ /* Get size of local heap for EFL message's file list */
+ if(H5D__efl_bh_info(loc->file, dxpl_id, &efl, &(bh_info->heap_size)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine EFL heap info")
} /* end if */
done:
/* Free messages, if they've been read in */
- if(layout_read && H5O_msg_reset(H5O_LAYOUT_ID, layout) < 0)
+ if(layout_read && H5O_msg_reset(H5O_LAYOUT_ID, &layout) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset data storage layout message")
if(efl_read && H5O_msg_reset(H5O_EFL_ID, &efl) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset external file list message")
- if(layout)
- layout = H5FL_FREE(H5O_layout_t, layout);
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__dset_bh_info() */
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index 90c2b23..158701b 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -732,12 +732,12 @@ H5O_msg_free_real(const H5O_msg_class_t *type, void *msg_native)
/*-------------------------------------------------------------------------
* Function: H5O_msg_copy
*
- * Purpose: Copies a message. If MESG is is the null pointer then a null
- * pointer is returned with no error.
+ * Purpose: Copies a message. If MESG is is the null pointer then a null
+ * pointer is returned with no error.
*
- * Return: Success: Ptr to the new message
+ * Return: Success: Ptr to the new message
*
- * Failure: NULL
+ * Failure: NULL
*
* Programmer: Robb Matzke
* Thursday, May 21, 1998
@@ -748,7 +748,7 @@ void *
H5O_msg_copy(unsigned type_id, const void *mesg, void *dst)
{
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
- void *ret_value = NULL; /* Return value */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index ea4a05a..3b4c159 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -200,8 +200,6 @@ const H5P_libclass_t H5P_CLS_DCRT[1] = {{
/* Declare extern the free list to manage blocks of type conversion data */
H5FL_BLK_EXTERN(type_conv);
-/* Declare a free list to manage the H5O_layout_t struct */
-H5FL_EXTERN(H5O_layout_t);
/***************************/
/* Local Private Variables */
@@ -294,7 +292,7 @@ H5P__dcrt_layout_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *na
size_t H5_ATTR_UNUSED size, void *value)
{
H5O_layout_t *layout = (H5O_layout_t *)value; /* Create local aliases for values */
- H5O_layout_t *new_layout = NULL;
+ H5O_layout_t new_layout;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -303,18 +301,13 @@ H5P__dcrt_layout_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *na
HDassert(value);
/* Make copy of layout */
- if(NULL == (new_layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for layout")
- if(NULL == H5O_msg_copy(H5O_LAYOUT_ID, layout, new_layout))
+ if(NULL == H5O_msg_copy(H5O_LAYOUT_ID, layout, &new_layout))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy layout")
/* Copy new layout message over old one */
- *layout = *new_layout;
+ *layout = new_layout;
done:
- if(new_layout)
- new_layout = H5FL_FREE(H5O_layout_t, new_layout);
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__dcrt_layout_set() */
@@ -337,7 +330,7 @@ H5P__dcrt_layout_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *na
size_t H5_ATTR_UNUSED size, void *value)
{
H5O_layout_t *layout = (H5O_layout_t *)value; /* Create local aliases for values */
- H5O_layout_t *new_layout = NULL;
+ H5O_layout_t new_layout;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -346,18 +339,13 @@ H5P__dcrt_layout_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *na
HDassert(value);
/* Make copy of layout */
- if(NULL == (new_layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for layout")
- if(NULL == H5O_msg_copy(H5O_LAYOUT_ID, layout, new_layout))
+ if(NULL == H5O_msg_copy(H5O_LAYOUT_ID, layout, &new_layout))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy layout")
/* Copy new layout message over old one */
- *layout = *new_layout;
+ *layout = new_layout;
done:
- if(new_layout)
- new_layout = H5FL_FREE(H5O_layout_t, new_layout);
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__dcrt_layout_get() */
@@ -516,7 +504,7 @@ static herr_t
H5P__dcrt_layout_dec(const void **_pp, void *value)
{
const H5O_layout_t *layout; /* Storage layout */
- H5O_layout_t *tmp_layout = NULL; /* Temporary local layout structure */
+ H5O_layout_t tmp_layout; /* Temporary local layout structure */
H5D_layout_t type; /* Layout type */
const uint8_t **pp = (const uint8_t **)_pp;
herr_t ret_value = SUCCEED; /* Return value */
@@ -555,20 +543,16 @@ H5P__dcrt_layout_dec(const void **_pp, void *value)
else { /* chunk layout structure is encoded*/
unsigned u; /* Local index variable */
- /* Allocate temporary layout */
- if(NULL == (tmp_layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for temp layout")
-
/* Initialize to default values */
- *tmp_layout = H5D_def_layout_chunk_g;
+ tmp_layout = H5D_def_layout_chunk_g;
/* Set rank & dimensions */
- tmp_layout->u.chunk.ndims = (unsigned)ndims;
+ tmp_layout.u.chunk.ndims = (unsigned)ndims;
for(u = 0; u < ndims; u++)
- UINT32DECODE(*pp, tmp_layout->u.chunk.dim[u])
+ UINT32DECODE(*pp, tmp_layout.u.chunk.dim[u])
/* Point at the newly set up struct */
- layout = tmp_layout;
+ layout = &tmp_layout;
} /* end else */
}
break;
@@ -587,86 +571,82 @@ H5P__dcrt_layout_dec(const void **_pp, void *value)
size_t tmp_size;
size_t u; /* Local index variable */
- /* Allocate temporary layout */
- if(NULL == (tmp_layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for temp layout")
-
/* Initialize to default values */
- *tmp_layout = H5D_def_layout_virtual_g;
+ tmp_layout = H5D_def_layout_virtual_g;
/* Allocate entry list */
- if(NULL == (tmp_layout->storage.u.virt.list = (H5O_storage_virtual_ent_t *)H5MM_calloc((size_t)nentries * sizeof(H5O_storage_virtual_ent_t))))
+ if(NULL == (tmp_layout.storage.u.virt.list = (H5O_storage_virtual_ent_t *)H5MM_calloc((size_t)nentries * sizeof(H5O_storage_virtual_ent_t))))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "unable to allocate heap block")
- tmp_layout->storage.u.virt.list_nalloc = (size_t)nentries;
- tmp_layout->storage.u.virt.list_nused = (size_t)nentries;
+ tmp_layout.storage.u.virt.list_nalloc = (size_t)nentries;
+ tmp_layout.storage.u.virt.list_nused = (size_t)nentries;
/* Decode each entry */
for(u = 0; u < (size_t)nentries; u++) {
/* Source file name */
tmp_size = HDstrlen((const char *)*pp) + 1;
- if(NULL == (tmp_layout->storage.u.virt.list[u].source_file_name = (char *)H5MM_malloc(tmp_size)))
+ if(NULL == (tmp_layout.storage.u.virt.list[u].source_file_name = (char *)H5MM_malloc(tmp_size)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "unable to allocate memory for source file name")
- (void)HDmemcpy(tmp_layout->storage.u.virt.list[u].source_file_name, *pp, tmp_size);
+ (void)HDmemcpy(tmp_layout.storage.u.virt.list[u].source_file_name, *pp, tmp_size);
*pp += tmp_size;
/* Source dataset name */
tmp_size = HDstrlen((const char *)*pp) + 1;
- if(NULL == (tmp_layout->storage.u.virt.list[u].source_dset_name = (char *)H5MM_malloc(tmp_size)))
+ if(NULL == (tmp_layout.storage.u.virt.list[u].source_dset_name = (char *)H5MM_malloc(tmp_size)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "unable to allocate memory for source dataset name")
- (void)HDmemcpy(tmp_layout->storage.u.virt.list[u].source_dset_name, *pp, tmp_size);
+ (void)HDmemcpy(tmp_layout.storage.u.virt.list[u].source_dset_name, *pp, tmp_size);
*pp += tmp_size;
/* Source selection */
- if(NULL == (tmp_layout->storage.u.virt.list[u].source_select = H5S_decode(pp)))
+ if(NULL == (tmp_layout.storage.u.virt.list[u].source_select = H5S_decode(pp)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode source space selection")
- tmp_layout->storage.u.virt.list[u].source_space_status = H5O_VIRTUAL_STATUS_USER;
+ tmp_layout.storage.u.virt.list[u].source_space_status = H5O_VIRTUAL_STATUS_USER;
/* Virtual selection */
- if(NULL == (tmp_layout->storage.u.virt.list[u].source_dset.virtual_select = H5S_decode(pp)))
+ if(NULL == (tmp_layout.storage.u.virt.list[u].source_dset.virtual_select = H5S_decode(pp)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode virtual space selection")
- tmp_layout->storage.u.virt.list[u].virtual_space_status = H5O_VIRTUAL_STATUS_USER;
+ tmp_layout.storage.u.virt.list[u].virtual_space_status = H5O_VIRTUAL_STATUS_USER;
/* Parse source file and dataset names for "printf"
* style format specifiers */
- if(H5D_virtual_parse_source_name(tmp_layout->storage.u.virt.list[u].source_file_name, &tmp_layout->storage.u.virt.list[u].parsed_source_file_name, &tmp_layout->storage.u.virt.list[u].psfn_static_strlen, &tmp_layout->storage.u.virt.list[u].psfn_nsubs) < 0)
+ if(H5D_virtual_parse_source_name(tmp_layout.storage.u.virt.list[u].source_file_name, &tmp_layout.storage.u.virt.list[u].parsed_source_file_name, &tmp_layout.storage.u.virt.list[u].psfn_static_strlen, &tmp_layout.storage.u.virt.list[u].psfn_nsubs) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't parse source file name")
- if(H5D_virtual_parse_source_name(tmp_layout->storage.u.virt.list[u].source_dset_name, &tmp_layout->storage.u.virt.list[u].parsed_source_dset_name, &tmp_layout->storage.u.virt.list[u].psdn_static_strlen, &tmp_layout->storage.u.virt.list[u].psdn_nsubs) < 0)
+ if(H5D_virtual_parse_source_name(tmp_layout.storage.u.virt.list[u].source_dset_name, &tmp_layout.storage.u.virt.list[u].parsed_source_dset_name, &tmp_layout.storage.u.virt.list[u].psdn_static_strlen, &tmp_layout.storage.u.virt.list[u].psdn_nsubs) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't parse source dataset name")
/* Set source names in source_dset struct */
- if((tmp_layout->storage.u.virt.list[u].psfn_nsubs == 0)
- && (tmp_layout->storage.u.virt.list[u].psdn_nsubs == 0)) {
- if(tmp_layout->storage.u.virt.list[u].parsed_source_file_name)
- tmp_layout->storage.u.virt.list[u].source_dset.file_name = tmp_layout->storage.u.virt.list[u].parsed_source_file_name->name_segment;
+ if((tmp_layout.storage.u.virt.list[u].psfn_nsubs == 0)
+ && (tmp_layout.storage.u.virt.list[u].psdn_nsubs == 0)) {
+ if(tmp_layout.storage.u.virt.list[u].parsed_source_file_name)
+ tmp_layout.storage.u.virt.list[u].source_dset.file_name = tmp_layout.storage.u.virt.list[u].parsed_source_file_name->name_segment;
else
- tmp_layout->storage.u.virt.list[u].source_dset.file_name = tmp_layout->storage.u.virt.list[u].source_file_name;
- if(tmp_layout->storage.u.virt.list[u].parsed_source_dset_name)
- tmp_layout->storage.u.virt.list[u].source_dset.dset_name = tmp_layout->storage.u.virt.list[u].parsed_source_dset_name->name_segment;
+ tmp_layout.storage.u.virt.list[u].source_dset.file_name = tmp_layout.storage.u.virt.list[u].source_file_name;
+ if(tmp_layout.storage.u.virt.list[u].parsed_source_dset_name)
+ tmp_layout.storage.u.virt.list[u].source_dset.dset_name = tmp_layout.storage.u.virt.list[u].parsed_source_dset_name->name_segment;
else
- tmp_layout->storage.u.virt.list[u].source_dset.dset_name = tmp_layout->storage.u.virt.list[u].source_dset_name;
+ tmp_layout.storage.u.virt.list[u].source_dset.dset_name = tmp_layout.storage.u.virt.list[u].source_dset_name;
} /* end if */
/* unlim_dim fields */
- tmp_layout->storage.u.virt.list[u].unlim_dim_source = H5S_get_select_unlim_dim(tmp_layout->storage.u.virt.list[u].source_select);
- tmp_layout->storage.u.virt.list[u].unlim_dim_virtual = H5S_get_select_unlim_dim(tmp_layout->storage.u.virt.list[u].source_dset.virtual_select);
- tmp_layout->storage.u.virt.list[u].unlim_extent_source = HSIZE_UNDEF;
- tmp_layout->storage.u.virt.list[u].unlim_extent_virtual = HSIZE_UNDEF;
- tmp_layout->storage.u.virt.list[u].clip_size_source = HSIZE_UNDEF;
- tmp_layout->storage.u.virt.list[u].clip_size_virtual = HSIZE_UNDEF;
+ tmp_layout.storage.u.virt.list[u].unlim_dim_source = H5S_get_select_unlim_dim(tmp_layout.storage.u.virt.list[u].source_select);
+ tmp_layout.storage.u.virt.list[u].unlim_dim_virtual = H5S_get_select_unlim_dim(tmp_layout.storage.u.virt.list[u].source_dset.virtual_select);
+ tmp_layout.storage.u.virt.list[u].unlim_extent_source = HSIZE_UNDEF;
+ tmp_layout.storage.u.virt.list[u].unlim_extent_virtual = HSIZE_UNDEF;
+ tmp_layout.storage.u.virt.list[u].clip_size_source = HSIZE_UNDEF;
+ tmp_layout.storage.u.virt.list[u].clip_size_virtual = HSIZE_UNDEF;
/* Clipped selections */
- if(tmp_layout->storage.u.virt.list[u].unlim_dim_virtual < 0) {
- tmp_layout->storage.u.virt.list[u].source_dset.clipped_source_select = tmp_layout->storage.u.virt.list[u].source_select;
- tmp_layout->storage.u.virt.list[u].source_dset.clipped_virtual_select = tmp_layout->storage.u.virt.list[u].source_dset.virtual_select;
+ if(tmp_layout.storage.u.virt.list[u].unlim_dim_virtual < 0) {
+ tmp_layout.storage.u.virt.list[u].source_dset.clipped_source_select = tmp_layout.storage.u.virt.list[u].source_select;
+ tmp_layout.storage.u.virt.list[u].source_dset.clipped_virtual_select = tmp_layout.storage.u.virt.list[u].source_dset.virtual_select;
} /* end if */
/* Update min_dims */
- if(H5D_virtual_update_min_dims(tmp_layout, u) < 0)
+ if(H5D_virtual_update_min_dims(&tmp_layout, u) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to update virtual dataset minimum dimensions")
} /* end for */
/* Point at the newly set up struct */
- layout = tmp_layout;
+ layout = &tmp_layout;
} /* end else */
} /* end block */
break;
@@ -681,9 +661,6 @@ H5P__dcrt_layout_dec(const void **_pp, void *value)
HDmemcpy(value, layout, sizeof(H5O_layout_t));
done:
- if(tmp_layout)
- tmp_layout = H5FL_FREE(H5O_layout_t, tmp_layout);
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__dcrt_layout_dec() */
@@ -739,7 +716,7 @@ H5P__dcrt_layout_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED siz
void *value)
{
H5O_layout_t *layout = (H5O_layout_t *)value; /* Create local aliases for values */
- H5O_layout_t *new_layout = NULL;
+ H5O_layout_t new_layout;
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -747,18 +724,13 @@ H5P__dcrt_layout_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED siz
HDassert(layout);
/* Make copy of layout */
- if(NULL == (new_layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for layout")
- if(NULL == H5O_msg_copy(H5O_LAYOUT_ID, layout, new_layout))
+ if(NULL == H5O_msg_copy(H5O_LAYOUT_ID, layout, &new_layout))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy layout")
/* Set new layout message directly into property list */
- *layout = *new_layout;
+ *layout = new_layout;
done:
- if(new_layout)
- new_layout = H5FL_FREE(H5O_layout_t, new_layout);
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__dcrt_layout_copy() */
@@ -1945,14 +1917,21 @@ done:
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
*
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and get property for
+ * generic property list.
+ *
*-------------------------------------------------------------------------
*/
H5D_layout_t
H5Pget_layout(hid_t plist_id)
{
- H5P_genplist_t *plist; /* Property list pointer */
- H5O_layout_t *layout = NULL; /* Layout property */
- H5D_layout_t ret_value; /* Return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5O_layout_t layout; /* Layout property */
+ H5D_layout_t ret_value; /* Return value */
FUNC_ENTER_API(H5D_LAYOUT_ERROR)
H5TRACE1("Dl", "i", plist_id);
@@ -1962,18 +1941,13 @@ H5Pget_layout(hid_t plist_id)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5D_LAYOUT_ERROR, "can't find object for ID")
/* Peek at layout property */
- if(NULL == (layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5D_LAYOUT_ERROR, "can't get memory for layout")
- if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, layout) < 0)
+ if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5D_LAYOUT_ERROR, "can't get layout")
/* Set return value */
- ret_value = layout->type;
+ ret_value = layout.type;
done:
- if(layout)
- layout = H5FL_FREE(H5O_layout_t, layout);
-
FUNC_LEAVE_API(ret_value)
} /* ed H5Pget_layout() */
@@ -2005,11 +1979,11 @@ done:
herr_t
H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/])
{
- H5P_genplist_t *plist; /* Property list pointer */
- H5O_layout_t *chunk_layout = NULL; /* Layout information for setting chunk info */
- uint64_t chunk_nelmts; /* Number of elements in chunk */
- unsigned u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5O_layout_t chunk_layout; /* Layout information for setting chunk info */
+ uint64_t chunk_nelmts; /* Number of elements in chunk */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "iIs*[a1]h", plist_id, ndims, dim);
@@ -2032,10 +2006,8 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/])
#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */
/* Verify & initialize property's chunk dims */
- if(NULL == (chunk_layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for layout")
- HDmemcpy(chunk_layout, &H5D_def_layout_chunk_g, sizeof(H5D_def_layout_chunk_g));
- HDmemset(chunk_layout->u.chunk.dim, 0, sizeof(chunk_layout->u.chunk.dim));
+ HDmemcpy(&chunk_layout, &H5D_def_layout_chunk_g, sizeof(H5D_def_layout_chunk_g));
+ HDmemset(&chunk_layout.u.chunk.dim, 0, sizeof(chunk_layout.u.chunk.dim));
chunk_nelmts = 1;
for(u = 0; u < (unsigned)ndims; u++) {
if(dim[u] == 0)
@@ -2045,7 +2017,7 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/])
chunk_nelmts *= dim[u];
if(chunk_nelmts > (uint64_t)0xffffffff)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "number of elements in chunk must be < 4GB")
- chunk_layout->u.chunk.dim[u] = (uint32_t)dim[u]; /* Store user's chunk dimensions */
+ chunk_layout.u.chunk.dim[u] = (uint32_t)dim[u]; /* Store user's chunk dimensions */
} /* end for */
/* Get the plist structure */
@@ -2053,14 +2025,11 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/])
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Set chunk information in property list */
- chunk_layout->u.chunk.ndims = (unsigned)ndims;
- if(H5P__set_layout(plist, chunk_layout) < 0)
+ chunk_layout.u.chunk.ndims = (unsigned)ndims;
+ if(H5P__set_layout(plist, &chunk_layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set layout")
done:
- if(chunk_layout)
- chunk_layout = H5FL_FREE(H5O_layout_t, chunk_layout);
-
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_chunk() */
@@ -2092,9 +2061,9 @@ done:
int
H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[]/*out*/)
{
- H5P_genplist_t *plist; /* Property list pointer */
- H5O_layout_t *layout = NULL; /* Layout information */
- int ret_value; /* Return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5O_layout_t layout; /* Layout information */
+ int ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("Is", "iIsx", plist_id, max_ndims, dim);
@@ -2104,28 +2073,23 @@ H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[]/*out*/)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Peek at the layout property */
- if(NULL == (layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for layout")
- if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, layout) < 0)
+ if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout")
- if(H5D_CHUNKED != layout->type)
+ if(H5D_CHUNKED != layout.type)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a chunked storage layout")
if(dim) {
unsigned u; /* Local index variable */
/* Get the dimension sizes */
- for(u = 0; u < layout->u.chunk.ndims && u < (unsigned)max_ndims; u++)
- dim[u] = layout->u.chunk.dim[u];
+ for(u = 0; u < layout.u.chunk.ndims && u < (unsigned)max_ndims; u++)
+ dim[u] = layout.u.chunk.dim[u];
} /* end if */
/* Set the return value */
- ret_value = (int)layout->u.chunk.ndims;
+ ret_value = (int)layout.u.chunk.ndims;
done:
- if(layout)
- layout = H5FL_FREE(H5O_layout_t, layout);
-
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_chunk() */
@@ -2154,15 +2118,15 @@ herr_t
H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name,
const char *src_dset_name, hid_t src_space_id)
{
- H5P_genplist_t *plist; /* Property list pointer */
- H5O_layout_t *virtual_layout = NULL; /* Layout information for setting virtual info */
- H5S_t *vspace; /* Virtual dataset space selection */
- H5S_t *src_space; /* Source dataset space selection */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5O_layout_t virtual_layout; /* Layout information for setting virtual info */
+ H5S_t *vspace; /* Virtual dataset space selection */
+ H5S_t *src_space; /* Source dataset space selection */
H5O_storage_virtual_ent_t *old_list = NULL; /* List pointer previously on property list */
- H5O_storage_virtual_ent_t *ent = NULL; /* Convenience pointer to new VDS entry */
- hbool_t retrieved_layout = FALSE; /* Whether the layout has been retrieved */
- hbool_t free_list = FALSE; /* Whether to free the list of virtual entries */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_storage_virtual_ent_t *ent = NULL; /* Convenience pointer to new VDS entry */
+ hbool_t retrieved_layout = FALSE; /* Whether the layout has been retrieved */
+ hbool_t free_list = FALSE; /* Whether to free the list of virtual entries */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "ii*s*si", dcpl_id, vspace_id, src_file_name, src_dset_name,
@@ -2196,43 +2160,41 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name,
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get the current layout */
- if(NULL == (virtual_layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for virtual layout")
- if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, virtual_layout) < 0)
+ if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &virtual_layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get layout")
retrieved_layout = TRUE;
/* If the layout was not already virtual, Start with default virtual layout.
* Otherwise, add the mapping to the current list. */
- if(virtual_layout->type == H5D_VIRTUAL)
+ if(virtual_layout.type == H5D_VIRTUAL)
/* Save old list pointer for error recovery */
- old_list = virtual_layout->storage.u.virt.list;
+ old_list = virtual_layout.storage.u.virt.list;
else {
/* Reset the old layout */
- if(H5O_msg_reset(H5O_LAYOUT_ID, virtual_layout) < 0)
+ if(H5O_msg_reset(H5O_LAYOUT_ID, &virtual_layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release layout message")
/* Copy the default virtual layout */
- HDmemcpy(virtual_layout, &H5D_def_layout_virtual_g, sizeof(H5D_def_layout_virtual_g));
+ HDmemcpy(&virtual_layout, &H5D_def_layout_virtual_g, sizeof(H5D_def_layout_virtual_g));
/* Sanity check */
- HDassert(virtual_layout->storage.u.virt.list_nalloc == 0);
+ HDassert(virtual_layout.storage.u.virt.list_nalloc == 0);
} /* end else */
/* Expand list if necessary */
- if(virtual_layout->storage.u.virt.list_nused == virtual_layout->storage.u.virt.list_nalloc) {
+ if(virtual_layout.storage.u.virt.list_nused == virtual_layout.storage.u.virt.list_nalloc) {
H5O_storage_virtual_ent_t *x; /* Pointer to the new list */
- size_t new_alloc = MAX(H5D_VIRTUAL_DEF_LIST_SIZE, virtual_layout->storage.u.virt.list_nalloc * 2);
+ size_t new_alloc = MAX(H5D_VIRTUAL_DEF_LIST_SIZE, virtual_layout.storage.u.virt.list_nalloc * 2);
/* Expand size of entry list */
- if(NULL == (x = (H5O_storage_virtual_ent_t *)H5MM_realloc(virtual_layout->storage.u.virt.list, new_alloc * sizeof(H5O_storage_virtual_ent_t))))
+ if(NULL == (x = (H5O_storage_virtual_ent_t *)H5MM_realloc(virtual_layout.storage.u.virt.list, new_alloc * sizeof(H5O_storage_virtual_ent_t))))
HGOTO_ERROR(H5E_PLIST, H5E_RESOURCE, FAIL, "can't reallocate virtual dataset mapping list")
- virtual_layout->storage.u.virt.list = x;
- virtual_layout->storage.u.virt.list_nalloc = new_alloc;
+ virtual_layout.storage.u.virt.list = x;
+ virtual_layout.storage.u.virt.list_nalloc = new_alloc;
} /* end if */
/* Add virtual dataset mapping entry */
- ent = &virtual_layout->storage.u.virt.list[virtual_layout->storage.u.virt.list_nused];
+ ent = &virtual_layout.storage.u.virt.list[virtual_layout.storage.u.virt.list_nused];
HDmemset(ent, 0, sizeof(H5O_storage_virtual_ent_t)); /* Clear before starting to set up */
if(NULL == (ent->source_dset.virtual_select = H5S_copy(vspace, FALSE, TRUE)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy virtual selection")
@@ -2274,19 +2236,19 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid mapping entry")
/* Update min_dims */
- if(H5D_virtual_update_min_dims(virtual_layout, virtual_layout->storage.u.virt.list_nused) < 0)
+ if(H5D_virtual_update_min_dims(&virtual_layout, virtual_layout.storage.u.virt.list_nused) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to update virtual dataset minimum dimensions")
/* Finish adding entry */
- virtual_layout->storage.u.virt.list_nused++;
+ virtual_layout.storage.u.virt.list_nused++;
done:
/* Set VDS layout information in property list */
/* (Even on faliure, so there's not a mangled layout struct in the list) */
if(retrieved_layout) {
- if(H5P_poke(plist, H5D_CRT_LAYOUT_NAME, virtual_layout) < 0) {
+ if(H5P_poke(plist, H5D_CRT_LAYOUT_NAME, &virtual_layout) < 0) {
HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set layout")
- if(old_list != virtual_layout->storage.u.virt.list)
+ if(old_list != virtual_layout.storage.u.virt.list)
free_list = TRUE;
} /* end if */
} /* end if */
@@ -2312,12 +2274,9 @@ done:
/* Free list if necessary */
if(free_list)
- virtual_layout->storage.u.virt.list = (H5O_storage_virtual_ent_t *)H5MM_xfree(virtual_layout->storage.u.virt.list);
+ virtual_layout.storage.u.virt.list = (H5O_storage_virtual_ent_t *)H5MM_xfree(virtual_layout.storage.u.virt.list);
} /* end if */
- if(virtual_layout)
- virtual_layout = H5FL_FREE(H5O_layout_t, virtual_layout);
-
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_virtual() */
@@ -2339,9 +2298,9 @@ done:
herr_t
H5Pget_virtual_count(hid_t dcpl_id, size_t *count/*out*/)
{
- H5P_genplist_t *plist; /* Property list pointer */
- H5O_layout_t *layout = NULL; /* Layout information */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5O_layout_t layout; /* Layout information */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", dcpl_id, count);
@@ -2352,21 +2311,16 @@ H5Pget_virtual_count(hid_t dcpl_id, size_t *count/*out*/)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Retrieve the layout property */
- if(NULL == (layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for layout")
- if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, layout) < 0)
+ if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout")
- if(H5D_VIRTUAL != layout->type)
+ if(H5D_VIRTUAL != layout.type)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout")
/* Return the number of mappings */
- *count = layout->storage.u.virt.list_nused;
+ *count = layout.storage.u.virt.list_nused;
} /* end if */
done:
- if(layout)
- layout = H5FL_FREE(H5O_layout_t, layout);
-
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_virtual_count() */
@@ -2390,10 +2344,10 @@ done:
hid_t
H5Pget_virtual_vspace(hid_t dcpl_id, size_t index)
{
- H5P_genplist_t *plist; /* Property list pointer */
- H5O_layout_t *layout = NULL; /* Layout information */
- H5S_t *space = NULL; /* Dataspace pointer */
- hid_t ret_value; /* Return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5O_layout_t layout; /* Layout information */
+ H5S_t *space = NULL; /* Dataspace pointer */
+ hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("i", "iz", dcpl_id, index);
@@ -2403,18 +2357,16 @@ H5Pget_virtual_vspace(hid_t dcpl_id, size_t index)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Retrieve the layout property */
- if(NULL == (layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for layout")
- if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, layout) < 0)
+ if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout")
- if(H5D_VIRTUAL != layout->type)
+ if(H5D_VIRTUAL != layout.type)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout")
/* Get the virtual space */
- if(index >= layout->storage.u.virt.list_nused)
+ if(index >= layout.storage.u.virt.list_nused)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)")
- HDassert(layout->storage.u.virt.list_nused <= layout->storage.u.virt.list_nalloc);
- if(NULL == (space = H5S_copy(layout->storage.u.virt.list[index].source_dset.virtual_select, FALSE, TRUE)))
+ HDassert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc);
+ if(NULL == (space = H5S_copy(layout.storage.u.virt.list[index].source_dset.virtual_select, FALSE, TRUE)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy virtual selection")
/* Register ID */
@@ -2427,9 +2379,6 @@ done:
if(H5S_close(space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release source selection")
- if(layout)
- layout = H5FL_FREE(H5O_layout_t, layout);
-
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_virtual_vspace() */
@@ -2453,10 +2402,10 @@ done:
hid_t
H5Pget_virtual_srcspace(hid_t dcpl_id, size_t index)
{
- H5P_genplist_t *plist; /* Property list pointer */
- H5O_layout_t *layout = NULL; /* Layout information */
- H5S_t *space = NULL; /* Dataspace pointer */
- hid_t ret_value = FAIL; /* Return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5O_layout_t layout; /* Layout information */
+ H5S_t *space = NULL; /* Dataspace pointer */
+ hid_t ret_value = FAIL; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("i", "iz", dcpl_id, index);
@@ -2466,35 +2415,33 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t index)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Retrieve the layout property */
- if(NULL == (layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for layout")
- if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, layout) < 0)
+ if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout")
- if(H5D_VIRTUAL != layout->type)
+ if(H5D_VIRTUAL != layout.type)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout")
/* Check index */
- if(index >= layout->storage.u.virt.list_nused)
+ if(index >= layout.storage.u.virt.list_nused)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)")
- HDassert(layout->storage.u.virt.list_nused <= layout->storage.u.virt.list_nalloc);
+ HDassert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc);
/* Attempt to open source dataset and patch extent if extent status is not
* H5O_VIRTUAL_STATUS_CORRECT? -NAF */
/* If source space status is H5O_VIRTUAL_STATUS_INVALID, patch with bounds
* of selection */
- if((H5O_VIRTUAL_STATUS_INVALID == layout->storage.u.virt.list[index].source_space_status)
- && (layout->storage.u.virt.list[index].unlim_dim_source < 0)) {
+ if((H5O_VIRTUAL_STATUS_INVALID == layout.storage.u.virt.list[index].source_space_status)
+ && (layout.storage.u.virt.list[index].unlim_dim_source < 0)) {
hsize_t bounds_start[H5S_MAX_RANK];
hsize_t bounds_end[H5S_MAX_RANK];
int rank;
int i;
/* Get rank of source space */
- if((rank = H5S_GET_EXTENT_NDIMS(layout->storage.u.virt.list[index].source_select)) < 0)
+ if((rank = H5S_GET_EXTENT_NDIMS(layout.storage.u.virt.list[index].source_select)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get source space rank")
/* Get bounds of selection */
- if(H5S_SELECT_BOUNDS(layout->storage.u.virt.list[index].source_select, bounds_start, bounds_end) < 0)
+ if(H5S_SELECT_BOUNDS(layout.storage.u.virt.list[index].source_select, bounds_start, bounds_end) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get selection bounds")
/* Adjust bounds to extent */
@@ -2502,15 +2449,15 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t index)
bounds_end[i]++;
/* Set extent */
- if(H5S_set_extent_simple(layout->storage.u.virt.list[index].source_select, (unsigned)rank, bounds_end, NULL) < 0)
+ if(H5S_set_extent_simple(layout.storage.u.virt.list[index].source_select, (unsigned)rank, bounds_end, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set source space extent")
/* Update source space status */
- layout->storage.u.virt.list[index].source_space_status = H5O_VIRTUAL_STATUS_SEL_BOUNDS;
+ layout.storage.u.virt.list[index].source_space_status = H5O_VIRTUAL_STATUS_SEL_BOUNDS;
} /* end if */
/* Get the source space */
- if(NULL == (space = H5S_copy(layout->storage.u.virt.list[index].source_select, FALSE, TRUE)))
+ if(NULL == (space = H5S_copy(layout.storage.u.virt.list[index].source_select, FALSE, TRUE)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy source selection")
/* Register ID */
@@ -2523,9 +2470,6 @@ done:
if(H5S_close(space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release source selection")
- if(layout)
- layout = H5FL_FREE(H5O_layout_t, layout);
-
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_virtual_srcspace() */
@@ -2564,7 +2508,7 @@ H5Pget_virtual_filename(hid_t dcpl_id, size_t index, char *name/*out*/,
size_t size)
{
H5P_genplist_t *plist; /* Property list pointer */
- H5O_layout_t *layout = NULL; /* Layout information */
+ H5O_layout_t layout; /* Layout information */
ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -2575,26 +2519,21 @@ H5Pget_virtual_filename(hid_t dcpl_id, size_t index, char *name/*out*/,
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Retrieve the layout property */
- if(NULL == (layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for layout")
- if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, layout) < 0)
+ if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout")
- if(H5D_VIRTUAL != layout->type)
+ if(H5D_VIRTUAL != layout.type)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout")
/* Get the virtual filename */
- if(index >= layout->storage.u.virt.list_nused)
+ if(index >= layout.storage.u.virt.list_nused)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)")
- HDassert(layout->storage.u.virt.list_nused <= layout->storage.u.virt.list_nalloc);
- HDassert(layout->storage.u.virt.list[index].source_file_name);
+ HDassert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc);
+ HDassert(layout.storage.u.virt.list[index].source_file_name);
if(name && (size > 0))
- (void)HDstrncpy(name, layout->storage.u.virt.list[index].source_file_name, size);
- ret_value = (ssize_t)HDstrlen(layout->storage.u.virt.list[index].source_file_name);
+ (void)HDstrncpy(name, layout.storage.u.virt.list[index].source_file_name, size);
+ ret_value = (ssize_t)HDstrlen(layout.storage.u.virt.list[index].source_file_name);
done:
- if(layout)
- layout = H5FL_FREE(H5O_layout_t, layout);
-
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_virtual_filename() */
@@ -2632,7 +2571,7 @@ H5Pget_virtual_dsetname(hid_t dcpl_id, size_t index, char *name/*out*/,
size_t size)
{
H5P_genplist_t *plist; /* Property list pointer */
- H5O_layout_t *layout = NULL; /* Layout information */
+ H5O_layout_t layout; /* Layout information */
ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -2643,26 +2582,21 @@ H5Pget_virtual_dsetname(hid_t dcpl_id, size_t index, char *name/*out*/,
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Retrieve the layout property */
- if(NULL == (layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for layout")
- if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, layout) < 0)
+ if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout")
- if(H5D_VIRTUAL != layout->type)
+ if(H5D_VIRTUAL != layout.type)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout")
/* Get the virtual filename */
- if(index >= layout->storage.u.virt.list_nused)
+ if(index >= layout.storage.u.virt.list_nused)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)")
- HDassert(layout->storage.u.virt.list_nused <= layout->storage.u.virt.list_nalloc);
- HDassert(layout->storage.u.virt.list[index].source_dset_name);
+ HDassert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc);
+ HDassert(layout.storage.u.virt.list[index].source_dset_name);
if(name && (size > 0))
- (void)HDstrncpy(name, layout->storage.u.virt.list[index].source_dset_name, size);
- ret_value = (ssize_t)HDstrlen(layout->storage.u.virt.list[index].source_dset_name);
+ (void)HDstrncpy(name, layout.storage.u.virt.list[index].source_dset_name, size);
+ ret_value = (ssize_t)HDstrlen(layout.storage.u.virt.list[index].source_dset_name);
done:
- if(layout)
- layout = H5FL_FREE(H5O_layout_t, layout);
-
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_virtual_dsetname() */
@@ -2684,7 +2618,7 @@ herr_t
H5Pset_chunk_opts(hid_t plist_id, unsigned options)
{
H5P_genplist_t *plist; /* Property list pointer */
- H5O_layout_t *layout = NULL; /* Layout information for setting chunk info */
+ H5O_layout_t layout; /* Layout information for setting chunk info */
uint8_t layout_flags = 0; /* "options" translated into layout message flags format */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2709,11 +2643,9 @@ H5Pset_chunk_opts(hid_t plist_id, unsigned options)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Retrieve the layout property */
- if(NULL == (layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for layout")
- if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, layout) < 0)
+ if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout")
- if(H5D_CHUNKED != layout->type)
+ if(H5D_CHUNKED != layout.type)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a chunked storage layout")
/* Translate options into flags that can be used with the layout message */
@@ -2723,18 +2655,15 @@ H5Pset_chunk_opts(hid_t plist_id, unsigned options)
/* Update the layout message, including the version (if necessary) */
/* This probably isn't the right way to do this, and should be changed once
* this branch gets the "real" way to set the layout version */
- layout->u.chunk.flags = layout_flags;
- if(layout->version < H5O_LAYOUT_VERSION_4)
- layout->version = H5O_LAYOUT_VERSION_4;
+ layout.u.chunk.flags = layout_flags;
+ if(layout.version < H5O_LAYOUT_VERSION_4)
+ layout.version = H5O_LAYOUT_VERSION_4;
/* Set layout value */
- if(H5P_poke(plist, H5D_CRT_LAYOUT_NAME, layout) < 0)
+ if(H5P_poke(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout")
done:
- if(layout)
- layout = H5FL_FREE(H5O_layout_t, layout);
-
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_chunk_opts() */
@@ -2754,8 +2683,8 @@ done:
herr_t
H5Pget_chunk_opts(hid_t plist_id, unsigned *options)
{
- H5P_genplist_t *plist = NULL; /* Property list pointer */
- H5O_layout_t *layout = NULL; /* Layout information for getting chunk info */
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5O_layout_t layout; /* Layout information for setting chunk info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -2775,25 +2704,20 @@ H5Pget_chunk_opts(hid_t plist_id, unsigned *options)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Retrieve the layout property */
- if(NULL == (layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for layout")
- if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, layout) < 0)
+ if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout")
- if(H5D_CHUNKED != layout->type)
+ if(H5D_CHUNKED != layout.type)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a chunked storage layout")
if(options) {
/* Translate options from flags that can be used with the layout message
* to those known to the public */
*options = 0;
- if(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS)
+ if(layout.u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS)
*options |= H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS;
} /* end if */
done:
- if(layout)
- layout = H5FL_FREE(H5O_layout_t, layout);
-
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_chunk_opts() */
@@ -3602,7 +3526,6 @@ H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time)
{
H5P_genplist_t *plist; /* Property list pointer */
H5O_fill_t fill; /* Fill value property to modify */
- H5O_layout_t *layout = NULL; /* Type of storage layout */
unsigned alloc_time_state; /* State of allocation time property */
herr_t ret_value = SUCCEED; /* return value */
@@ -3615,19 +3538,18 @@ H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time)
/* Get the property list structure */
if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Check for resetting to default for layout type */
if(alloc_time == H5D_ALLOC_TIME_DEFAULT) {
+ H5O_layout_t layout; /* Type of storage layout */
/* Peek at the storage layout */
- if(NULL == (layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for layout")
- if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, layout) < 0)
+ if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get layout")
/* Set the default based on layout */
- switch(layout->type) {
+ switch(layout.type) {
case H5D_COMPACT:
alloc_time = H5D_ALLOC_TIME_EARLY;
break;
@@ -3671,9 +3593,6 @@ H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time")
done:
- if(layout)
- layout = H5FL_FREE(H5O_layout_t, layout);
-
FUNC_LEAVE_API(ret_value)
} /* H5Pset_alloc_time() */
diff --git a/src/H5Z.c b/src/H5Z.c
index f1fe8df..ef34d7c 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -11,21 +11,13 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/****************/
-/* Module Setup */
-/****************/
-
#include "H5Zmodule.h" /* This source code file is part of the H5Z module */
-/***********/
-/* Headers */
-/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Dprivate.h" /* Dataset functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* File */
-#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Oprivate.h" /* Object headers */
@@ -38,16 +30,7 @@
# include "szlib.h"
#endif
-
-/****************/
-/* Local Macros */
-/****************/
-
-
-/******************/
-/* Local Typedefs */
-/******************/
-
+/* Local typedefs */
#ifdef H5Z_DEBUG
typedef struct H5Z_stats_t {
struct {
@@ -72,41 +55,19 @@ typedef enum {
/* Package initialization variable */
hbool_t H5_PKG_INIT_VAR = FALSE;
-
-/********************/
-/* Local Prototypes */
-/********************/
-static int H5Z_find_idx(H5Z_filter_t id);
-static int H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t obj_id, void *key);
-static int H5Z__check_unregister_group_cb(void *obj_ptr, hid_t obj_id, void *key);
-static int H5Z__flush_file_cb(void *obj_ptr, hid_t obj_id, void *key);
-
-
-/*********************/
-/* Package Variables */
-/*********************/
-
-
-/*****************************/
-/* Library Private Variables */
-/*****************************/
-
-
-/*******************/
-/* Local Variables */
-/*******************/
-
+/* Local variables */
static size_t H5Z_table_alloc_g = 0;
static size_t H5Z_table_used_g = 0;
static H5Z_class2_t *H5Z_table_g = NULL;
-
#ifdef H5Z_DEBUG
static H5Z_stats_t *H5Z_stat_table_g = NULL;
#endif /* H5Z_DEBUG */
-/* Declare a free list to manage the H5O_layout_t struct */
-H5FL_EXTERN(H5O_layout_t);
-
+/* Local functions */
+static int H5Z_find_idx(H5Z_filter_t id);
+static int H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t obj_id, void *key);
+static int H5Z__check_unregister_group_cb(void *obj_ptr, hid_t obj_id, void *key);
+static int H5Z__flush_file_cb(void *obj_ptr, hid_t obj_id, void *key);
/*-------------------------------------------------------------------------
@@ -850,9 +811,8 @@ done:
static herr_t
H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_type)
{
- hid_t space_id = -1; /* ID for dataspace describing chunk */
- H5O_layout_t *dcpl_layout = NULL; /* Dataset's layout information */
- herr_t ret_value = SUCCEED; /* Return value */
+ hid_t space_id = -1; /* ID for dataspace describing chunk */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -862,20 +822,18 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type
/* Check if the property list is non-default */
if(dcpl_id != H5P_DATASET_CREATE_DEFAULT) {
H5P_genplist_t *dc_plist; /* Dataset creation property list object */
-
- if(NULL == (dcpl_layout = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't get memory for layout")
+ H5O_layout_t dcpl_layout; /* Dataset's layout information */
/* Get dataset creation property list object */
if(NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list")
/* Peek at the layout information */
- if(H5P_peek(dc_plist, H5D_CRT_LAYOUT_NAME, dcpl_layout) < 0)
+ if(H5P_peek(dc_plist, H5D_CRT_LAYOUT_NAME, &dcpl_layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout")
/* Check if the dataset is chunked */
- if(H5D_CHUNKED == dcpl_layout->type) {
+ if(H5D_CHUNKED == dcpl_layout.type) {
H5O_pline_t dcpl_pline; /* Object's I/O pipeline information */
/* Get I/O pipeline information */
@@ -889,9 +847,9 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type
size_t u; /* Local index variable */
/* Create a data space for a chunk & set the extent */
- for(u = 0; u < dcpl_layout->u.chunk.ndims; u++)
- chunk_dims[u] = dcpl_layout->u.chunk.dim[u];
- if(NULL == (space = H5S_create_simple(dcpl_layout->u.chunk.ndims, chunk_dims, NULL)))
+ for(u = 0; u < dcpl_layout.u.chunk.ndims; u++)
+ chunk_dims[u] = dcpl_layout.u.chunk.dim[u];
+ if(NULL == (space = H5S_create_simple(dcpl_layout.u.chunk.ndims, chunk_dims, NULL)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
/* Get ID for dataspace to pass to filter routines */
@@ -910,8 +868,6 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type
done:
if(space_id > 0 && H5I_dec_ref(space_id) < 0)
HDONE_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace")
- if(dcpl_layout)
- dcpl_layout = H5FL_FREE(H5O_layout_t, dcpl_layout);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_prepare_prelude_callback_dcpl() */