diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-11-22 17:14:40 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-11-22 17:14:40 (GMT) |
commit | 2cf4e3037702673813530c31e7983794faf2bac2 (patch) | |
tree | 163a3de8816f4d59fa0cdf2d4d7e0359dba15925 /src/H5Ofill.c | |
parent | e99a1f7838d12cb734edf860b15da18d2e4e5f83 (diff) | |
download | hdf5-2cf4e3037702673813530c31e7983794faf2bac2.zip hdf5-2cf4e3037702673813530c31e7983794faf2bac2.tar.gz hdf5-2cf4e3037702673813530c31e7983794faf2bac2.tar.bz2 |
[svn-r9557] Purpose:
Code cleanup & optimization
Description:
Improve ADF/CGNS benchmark by reducing the number of internal attribute
copies made during creations, opens and writes.
Added new H5O_iterate() routine for iterating through messages of a certain
type in the object header (attributes are the only message currently that can
have multiple instances in the object header).
Cross-pollinated various minor code cleanups to reduce diffs between
branches.
Platforms tested:
FreeBSD 4.10 (sleipnir) w/parallel
Solaris 2.7 (arabica)
Too minor to require h5committest
Diffstat (limited to 'src/H5Ofill.c')
-rw-r--r-- | src/H5Ofill.c | 94 |
1 files changed, 35 insertions, 59 deletions
diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 4a4443d..bf01af8 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -33,7 +33,7 @@ static void *H5O_fill_new_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg); -static void *H5O_fill_new_copy(const void *_mesg, void *_dest); +static void *H5O_fill_new_copy(const void *_mesg, void *_dest, unsigned update_flags); static size_t H5O_fill_new_size(H5F_t *f, const void *_mesg); static herr_t H5O_fill_new_reset(void *_mesg); static herr_t H5O_fill_new_free(void *_mesg); @@ -42,7 +42,7 @@ static herr_t H5O_fill_new_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FIL static void *H5O_fill_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_fill_encode(H5F_t *f, uint8_t *p, const void *_mesg); -static void *H5O_fill_copy(const void *_mesg, void *_dest); +static void *H5O_fill_copy(const void *_mesg, void *_dest, unsigned update_flags); static size_t H5O_fill_size(H5F_t *f, const void *_mesg); static herr_t H5O_fill_reset(void *_mesg); static herr_t H5O_fill_free(void *_mesg); @@ -85,7 +85,7 @@ const H5O_class_t H5O_FILL_NEW[1] = {{ H5O_fill_new_debug, /*debug the message */ }}; -/* Initial version of the "new" fill value information */ +/* Initial version of the "old" fill value information */ #define H5O_FILL_VERSION 1 /* Revised version of the "new" fill value information */ #define H5O_FILL_VERSION_2 2 @@ -127,7 +127,7 @@ H5O_fill_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p, int version; void *ret_value; - FUNC_ENTER_NOAPI(H5O_fill_new_decode, NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_fill_new_decode); assert(f); assert(p); @@ -200,7 +200,7 @@ H5O_fill_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p, H5O_fill_t *mesg=NULL; void *ret_value; - FUNC_ENTER_NOAPI(H5O_fill_decode, NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_fill_decode); assert(f); assert(p); @@ -249,9 +249,8 @@ static herr_t H5O_fill_new_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg) { const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_fill_new_encode, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_encode); assert(f); assert(p); @@ -274,8 +273,7 @@ H5O_fill_new_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg) HDmemcpy(p, mesg->buf, (size_t)mesg->size); } /* end if */ -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -297,9 +295,8 @@ static herr_t H5O_fill_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg) { const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg; - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5O_fill_encode, FAIL); + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_encode); assert(f); assert(p); @@ -309,8 +306,7 @@ H5O_fill_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg) if(mesg->buf) HDmemcpy(p, mesg->buf, mesg->size); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -334,13 +330,13 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_fill_new_copy(const void *_mesg, void *_dest) +H5O_fill_new_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags) { const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg; H5O_fill_new_t *dest = (H5O_fill_new_t *)_dest; void *ret_value; - FUNC_ENTER_NOAPI(H5O_fill_new_copy, NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_fill_new_copy); assert(mesg); @@ -406,13 +402,13 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_fill_copy(const void *_mesg, void *_dest) +H5O_fill_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags) { const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg; H5O_fill_t *dest = (H5O_fill_t *)_dest; void *ret_value; - FUNC_ENTER_NOAPI(H5O_fill_copy, NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_fill_copy); assert(mesg); @@ -478,7 +474,7 @@ H5O_fill_new_size(H5F_t UNUSED *f, const void *_mesg) const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg; size_t ret_value; - FUNC_ENTER_NOAPI(H5O_fill_new_size, 0); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_size); assert(f); assert(mesg); @@ -490,7 +486,6 @@ H5O_fill_new_size(H5F_t UNUSED *f, const void *_mesg) 4 + /* Fill value size */ (mesg->size>0 ? mesg->size : 0); /* Size of fill value */ -done: FUNC_LEAVE_NOAPI(ret_value); } @@ -517,18 +512,13 @@ static size_t H5O_fill_size(H5F_t UNUSED *f, const void *_mesg) { const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg; - size_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_fill_size, 0); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_size); assert(f); assert(mesg); - /* Set return value */ - ret_value=4+mesg->size; - -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(4+mesg->size); } @@ -552,9 +542,8 @@ static herr_t H5O_fill_new_reset(void *_mesg) { H5O_fill_new_t *mesg = (H5O_fill_new_t *)_mesg; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_fill_new_reset, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_reset); assert(mesg); @@ -569,8 +558,7 @@ H5O_fill_new_reset(void *_mesg) mesg->fill_time = (H5D_fill_time_t)0; mesg->fill_defined = FALSE; -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -594,7 +582,7 @@ H5O_fill_reset(void *_mesg) H5O_fill_t *mesg = (H5O_fill_t *)_mesg; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_fill_reset, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_reset); assert(mesg); @@ -606,7 +594,6 @@ H5O_fill_reset(void *_mesg) mesg->type = NULL; } -done: FUNC_LEAVE_NOAPI(ret_value); } @@ -628,16 +615,13 @@ done: static herr_t H5O_fill_new_free (void *mesg) { - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5O_fill_new_free, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_free); assert (mesg); H5FL_FREE(H5O_fill_new_t,mesg); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -658,16 +642,13 @@ done: static herr_t H5O_fill_free (void *mesg) { - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5O_fill_free, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_free); assert (mesg); H5FL_FREE(H5O_fill_t,mesg); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -691,9 +672,8 @@ H5O_fill_new_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FIL { const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg; H5D_fill_value_t fill_status; /* Whether the fill value is defined */ - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_fill_new_debug, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_debug); assert(f); assert(mesg); @@ -771,8 +751,7 @@ H5O_fill_new_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FIL fprintf(stream, "<dataset type>\n"); } -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -795,9 +774,8 @@ H5O_fill_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *s int indent, int fwidth) { const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_fill_debug, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_debug); assert(f); assert(mesg); @@ -815,8 +793,7 @@ H5O_fill_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *s fprintf(stream, "<dataset type>\n"); } -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -843,10 +820,10 @@ H5O_fill_convert(void *_fill, H5T_t *dset_type, hid_t dxpl_id) H5O_fill_new_t *fill = _fill; H5T_path_t *tpath=NULL; /*type conversion info */ void *buf=NULL, *bkg=NULL; /*conversion buffers */ - hid_t src_id=-1, dst_id=-1; /*data type identifiers */ + hid_t src_id=-1, dst_id=-1; /*datatype identifiers */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_fill_convert, FAIL); + FUNC_ENTER_NOAPI_NOINIT(H5O_fill_convert); assert(fill); assert(dset_type); @@ -862,10 +839,9 @@ H5O_fill_convert(void *_fill, H5T_t *dset_type, hid_t dxpl_id) /* * Can we convert between source and destination data types? */ - if (NULL==(tpath=H5T_path_find(fill->type, dset_type, NULL, NULL, dxpl_id))) { - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, - "unable to convert between src and dst data types"); - } + if (NULL==(tpath=H5T_path_find(fill->type, dset_type, NULL, NULL, dxpl_id))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes") + /* Don't bother doing anything if there will be no actual conversion */ if (!H5T_path_noop(tpath)) { if ((src_id = H5I_register(H5I_DATATYPE, @@ -875,7 +851,7 @@ H5O_fill_convert(void *_fill, H5T_t *dset_type, hid_t dxpl_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register data type"); /* - * Data type conversions are always done in place, so we need a buffer + * Datatype conversions are always done in place, so we need a buffer * that is large enough for both source and destination. */ if (H5T_get_size(fill->type)>=H5T_get_size(dset_type)) { @@ -890,7 +866,7 @@ H5O_fill_convert(void *_fill, H5T_t *dset_type, hid_t dxpl_id) /* Do the conversion */ if (H5T_convert(tpath, src_id, dst_id, 1, 0, 0, buf, bkg, dxpl_id)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed"); /* Update the fill message */ if (buf!=fill->buf) { |