From 2cf4e3037702673813530c31e7983794faf2bac2 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 22 Nov 2004 12:14:40 -0500 Subject: [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 --- src/H5A.c | 170 +++++++++++++++++++++++++++++++------------------------ src/H5Apkg.h | 2 +- src/H5D.c | 4 +- src/H5Distore.c | 4 +- src/H5G.c | 27 ++++----- src/H5Gstab.c | 2 +- src/H5O.c | 128 +++++++++++++++++++++++++++++++++++------ src/H5Oattr.c | 11 ++-- src/H5Ocont.c | 1 - src/H5Odtype.c | 5 +- src/H5Oefl.c | 5 +- src/H5Ofill.c | 94 ++++++++++++------------------ src/H5Olayout.c | 42 +++++++------- src/H5Omtime.c | 61 +++++++------------- src/H5Oname.c | 30 ++++------ src/H5Opkg.h | 2 +- src/H5Opline.c | 52 +++++++---------- src/H5Oprivate.h | 12 +++- src/H5Osdspace.c | 37 +++++------- src/H5Oshared.c | 39 ++++++------- src/H5Ostab.c | 35 +++++------- src/H5Shyper.c | 6 +- src/H5Tcommit.c | 2 +- src/H5Zszip.c | 2 +- 24 files changed, 403 insertions(+), 370 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index abeb148..cef2767 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -43,6 +43,14 @@ static int H5A_get_index(H5G_entry_t *ent, const char *name, hid_t dxpl_id); static hsize_t H5A_get_storage_size(const H5A_t *attr); static herr_t H5A_rename(H5G_entry_t *ent, const char *old_name, const char *new_name, hid_t dxpl_id); +/* Object header iterator callbacks */ +/* Data structure for callback for locating the index by name */ +typedef struct H5A_iter_cb1 { + const char *name; + int idx; +} H5A_iter_cb1; +static herr_t H5A_find_idx_by_name(const void *mesg, unsigned idx, void *op_data); + /* The number of reserved IDs in dataset ID group */ #define H5A_RESERVED_ATOMS 0 @@ -218,8 +226,7 @@ H5A_create(const H5G_entry_t *ent, const char *name, const H5T_t *type, const H5S_t *space, hid_t dxpl_id) { H5A_t *attr = NULL; - H5A_t found_attr; - int seq=0; + H5A_iter_cb1 cb; /* Iterator callback */ hid_t ret_value = FAIL; FUNC_ENTER_NOAPI_NOINIT(H5A_create) @@ -230,6 +237,14 @@ H5A_create(const H5G_entry_t *ent, const char *name, const H5T_t *type, assert(type); assert(space); + /* Iterate over the existing attributes to check for duplicates */ + cb.name=name; + cb.idx=(-1); + if((ret_value=H5O_iterate(ent,H5O_ATTR_ID,H5A_find_idx_by_name,&cb,dxpl_id))<0) + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "error iterating over attributes") + if(ret_value>0) + HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, FAIL, "attribute already exists") + /* Check if the dataspace has an extent set (or is NULL) */ if( !(H5S_has_extent(space)) ) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace extent has not been set") @@ -284,25 +299,8 @@ H5A_create(const H5G_entry_t *ent, const char *name, const H5T_t *type, HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open") attr->ent_opened=1; - /* Read in the existing attributes to check for duplicates */ - seq=0; - while(H5O_read(&(attr->ent), H5O_ATTR_ID, seq, &found_attr, dxpl_id)!=NULL) { - /* - * Compare found attribute name to new attribute name reject creation - * if names are the same. - */ - if(HDstrcmp(found_attr.name,attr->name)==0) { - (void)H5O_reset (H5O_ATTR_ID, &found_attr); - HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, FAIL, "attribute already exists") - } - if(H5O_reset (H5O_ATTR_ID, &found_attr)<0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't release attribute info") - seq++; - } - H5E_clear (); - /* Create the attribute message and save the attribute index */ - if (H5O_modify(&(attr->ent), H5O_ATTR_ID, H5O_NEW_MESG, 0, 1, attr, dxpl_id) < 0) + if (H5O_modify(&(attr->ent), H5O_ATTR_ID, H5O_NEW_MESG, 0, H5O_UPDATE_TIME, attr, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to update attribute header messages") /* Register the new attribute and get an ID for it */ @@ -324,6 +322,52 @@ done: /*-------------------------------------------------------------------------- NAME + H5A_find_idx_by_name + PURPOSE + Iterator callback to determine the index of a attribute + USAGE + herr_t H5A_find_idx_by_name (mesg, idx, op_data) + const H5A_t *mesg; IN: Pointer to attribute + unsigned idx; IN: Index of attribute + void *op_data; IN: Op data passed in + RETURNS + Non-negative on success, negative on failure + + ERRORS + + DESCRIPTION + This function determines if an attribute matches the name to search + for (from the 'op_data') and sets the index value in the 'op_data'. +--------------------------------------------------------------------------*/ +static herr_t +H5A_find_idx_by_name(const void *_mesg, unsigned idx, void *_op_data) +{ + const H5A_t *mesg = (const H5A_t *)_mesg; /* Pointer to attribute */ + H5A_iter_cb1 *op_data = (H5A_iter_cb1 *)_op_data; /* Pointer to op data */ + int ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5A_find_idx_by_name) + + assert(mesg); + assert(op_data); + + /* + * Compare found attribute name to queried name and set the idx in the + * callback info if names are the same. + */ + if(HDstrcmp(mesg->name,op_data->name)==0) { + op_data->idx=idx; + ret_value=1; + } /* end if */ + else + ret_value=0; + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5A_find_idx_by_name() */ + + +/*-------------------------------------------------------------------------- + NAME H5A_get_index PURPOSE Determine the index of an attribute in an object header @@ -345,8 +389,7 @@ done: static int H5A_get_index(H5G_entry_t *ent, const char *name, hid_t dxpl_id) { - H5A_t found_attr; - int i; /* Index variable */ + H5A_iter_cb1 cb; /* Iterator callback */ int ret_value=FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5A_get_index) @@ -354,25 +397,13 @@ H5A_get_index(H5G_entry_t *ent, const char *name, hid_t dxpl_id) assert(ent); assert(name); - /* Look up the attribute for the object */ - i=0; - while(H5O_read(ent, H5O_ATTR_ID, i, &found_attr, dxpl_id)!=NULL) { - /* - * Compare found attribute name to new attribute name reject creation - * if names are the same. - */ - if(HDstrcmp(found_attr.name,name)==0) { - if(H5O_reset (H5O_ATTR_ID, &found_attr)<0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't release attribute info") - HGOTO_DONE(i); - } - if(H5O_reset (H5O_ATTR_ID, &found_attr)<0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't release attribute info") - i++; - } - H5E_clear (); - - if(ret_value<0) + cb.name=name; + cb.idx=(-1); + if((ret_value=H5O_iterate(ent,H5O_ATTR_ID,H5A_find_idx_by_name,&cb,dxpl_id))<0) + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "error iterating over attributes") + if(ret_value>0) + ret_value=cb.idx; + else HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "attribute not found") done: @@ -692,7 +723,7 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id) HGOTO_ERROR(H5E_ATTR, H5E_BADVALUE, FAIL, "attribute not found") /* Modify the attribute data */ - if (H5O_modify(&(attr->ent), H5O_ATTR_ID, idx, 0, 1, attr, dxpl_id) < 0) + if (H5O_modify(&(attr->ent), H5O_ATTR_ID, idx, 0, H5O_UPDATE_DATA_ONLY|H5O_UPDATE_TIME, attr, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to update attribute header messages") } /* end if */ @@ -1269,7 +1300,7 @@ H5A_rename(H5G_entry_t *ent, const char *old_name, const char *new_name, hid_t d found_attr.initialized=TRUE; /* Modify the attribute message */ - if (H5O_modify(ent, H5O_ATTR_ID, idx, 0, 1, &found_attr, dxpl_id) < 0) + if (H5O_modify(ent, H5O_ATTR_ID, idx, 0, H5O_UPDATE_TIME, &found_attr, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to update attribute header messages") /* Close the attribute */ @@ -1407,9 +1438,8 @@ done: herr_t H5Adelete(hid_t loc_id, const char *name) { - H5A_t found_attr; H5G_entry_t *ent = NULL; /*symtab ent of object to attribute */ - int idx=0, found=-1; + int found; herr_t ret_value; FUNC_ENTER_API(H5Adelete, FAIL) @@ -1423,25 +1453,8 @@ H5Adelete(hid_t loc_id, const char *name) if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - /* Look up the attribute for the object */ - idx=0; - while(H5O_read(ent, H5O_ATTR_ID, idx, &found_attr, H5AC_dxpl_id)!=NULL) { - /* - * Compare found attribute name to new attribute name reject - * creation if names are the same. - */ - if(HDstrcmp(found_attr.name,name)==0) { - if(H5O_reset (H5O_ATTR_ID, &found_attr)<0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't release attribute info") - found = idx; - break; - } - if(H5O_reset (H5O_ATTR_ID, &found_attr)<0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't release attribute info") - idx++; - } - H5E_clear (); - if (found<0) + /* Look up the attribute index for the object */ + if((found=H5A_get_index(ent,name,H5AC_dxpl_id))<0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "attribute not found") /* Delete the attribute from the location */ @@ -1508,7 +1521,7 @@ done: *------------------------------------------------------------------------- */ H5A_t * -H5A_copy(H5A_t *_new_attr, const H5A_t *old_attr) +H5A_copy(H5A_t *_new_attr, const H5A_t *old_attr, unsigned update_flags) { H5A_t *new_attr=NULL; hbool_t allocated_attr=FALSE; /* Whether the attribute was allocated */ @@ -1521,6 +1534,9 @@ H5A_copy(H5A_t *_new_attr, const H5A_t *old_attr) /* get space */ if(_new_attr==NULL) { + /* Sanity check - We should not be only updating data if we don'y have anything */ + HDassert(!(update_flags&H5O_UPDATE_DATA_ONLY)); + if (NULL==(new_attr = H5FL_MALLOC(H5A_t))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") allocated_attr=TRUE; @@ -1528,19 +1544,23 @@ H5A_copy(H5A_t *_new_attr, const H5A_t *old_attr) else new_attr=_new_attr; - /* Copy the top level of the attribute */ - *new_attr = *old_attr; + if(!(update_flags&H5O_UPDATE_DATA_ONLY)) { + /* Copy the top level of the attribute */ + *new_attr = *old_attr; - /* Don't open the object header for a copy */ - new_attr->ent_opened=0; + /* Don't open the object header for a copy */ + new_attr->ent_opened=0; - /* Copy the guts of the attribute */ - new_attr->name=HDstrdup(old_attr->name); - new_attr->dt=H5T_copy(old_attr->dt, H5T_COPY_ALL); - new_attr->ds=H5S_copy(old_attr->ds, FALSE); + /* Copy the guts of the attribute */ + new_attr->name=HDstrdup(old_attr->name); + new_attr->dt=H5T_copy(old_attr->dt, H5T_COPY_ALL); + new_attr->ds=H5S_copy(old_attr->ds, FALSE); + } /* end if */ if(old_attr->data) { - if (NULL==(new_attr->data=H5MM_malloc(old_attr->data_size))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + if(!(update_flags&H5O_UPDATE_DATA_ONLY) || new_attr->data==NULL) { + if (NULL==(new_attr->data=H5MM_malloc(old_attr->data_size))) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + } /* end if */ HDmemcpy(new_attr->data,old_attr->data,old_attr->data_size); } /* end if */ diff --git a/src/H5Apkg.h b/src/H5Apkg.h index a354a48..976340d 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -55,7 +55,7 @@ struct H5A_t { }; /* Function prototypes for H5A package scope */ -H5_DLL H5A_t *H5A_copy(H5A_t *new_attr, const H5A_t *old_attr); +H5_DLL H5A_t *H5A_copy(H5A_t *new_attr, const H5A_t *old_attr, unsigned update_flags); H5_DLL herr_t H5A_free(H5A_t *attr); H5_DLL herr_t H5A_close(H5A_t *attr); diff --git a/src/H5D.c b/src/H5D.c index ea9e613..7505257 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -2786,7 +2786,7 @@ H5D_close(H5D_t *dataset) case H5D_COMPACT: /* Update header message of layout for compact dataset. */ if(dataset->shared->layout.u.compact.dirty) { - if(H5O_modify(&(dataset->ent), H5O_LAYOUT_ID, 0, 0, 1, &(dataset->shared->layout), H5AC_dxpl_id)<0) + if(H5O_modify(&(dataset->ent), H5O_LAYOUT_ID, 0, 0, H5O_UPDATE_TIME, &(dataset->shared->layout), H5AC_dxpl_id)<0) HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to update layout message") dataset->shared->layout.u.compact.dirty = FALSE; } /* end if */ @@ -4029,7 +4029,7 @@ H5D_flush(H5F_t *f, hid_t dxpl_id, unsigned flags) case H5D_COMPACT: if(dataset->shared->layout.u.compact.dirty) { - if(H5O_modify(&(dataset->ent), H5O_LAYOUT_ID, 0, 0, 1, &(dataset->shared->layout), dxpl_id)<0) + if(H5O_modify(&(dataset->ent), H5O_LAYOUT_ID, 0, 0, H5O_UPDATE_TIME, &(dataset->shared->layout), dxpl_id)<0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message") dataset->shared->layout.u.compact.dirty = FALSE; } /* end if */ diff --git a/src/H5Distore.c b/src/H5Distore.c index 3673cad..22bba76 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -148,7 +148,7 @@ typedef struct H5D_istore_ud1_t { /* Private prototypes */ static void *H5D_istore_chunk_alloc(size_t size, const H5O_pline_t *pline); static void *H5D_istore_chunk_xfree(void *chk, const H5O_pline_t *pline); -static herr_t H5D_istore_shared_create (H5F_t *f, H5O_layout_t *layout); +static herr_t H5D_istore_shared_create (const H5F_t *f, H5O_layout_t *layout); static herr_t H5D_istore_shared_free (void *page); /* B-tree iterator callbacks */ @@ -1277,7 +1277,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_istore_shared_create (H5F_t *f, H5O_layout_t *layout) +H5D_istore_shared_create (const H5F_t *f, H5O_layout_t *layout) { H5D_istore_ud1_t udata; H5B_shared_t *shared; /* Shared B-tree node info */ diff --git a/src/H5G.c b/src/H5G.c index 6857244..5e473f8 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -186,8 +186,8 @@ static herr_t H5G_move(H5G_entry_t *src_loc, const char *src_name, static H5G_t * H5G_open_oid(H5G_entry_t *ent, hid_t dxpl_id); static herr_t H5G_unlink(H5G_entry_t *loc, const char *name, hid_t dxpl_id); static herr_t H5G_get_num_objs(H5G_entry_t *grp, hsize_t *num_objs, hid_t dxpl_id); -static ssize_t H5G_get_objname_by_idx(H5G_entry_t *grp, hsize_t idx, char* name, size_t size, hid_t dxpl_id); -static int H5G_get_objtype_by_idx(H5G_entry_t *grp, hsize_t idx, hid_t dxpl_id); +static ssize_t H5G_get_objname_by_idx(H5G_entry_t *loc, hsize_t idx, char* name, size_t size, hid_t dxpl_id); +static int H5G_get_objtype_by_idx(H5G_entry_t *loc, hsize_t idx, hid_t dxpl_id); static int H5G_replace_ent(void *obj_ptr, hid_t obj_id, void *key); static herr_t H5G_traverse_slink(H5G_entry_t *grp_ent/*in,out*/, H5G_entry_t *obj_ent/*in,out*/, int *nlinks/*in,out*/, hid_t dxpl_id); @@ -287,7 +287,7 @@ H5Gopen(hid_t loc_id, const char *name) H5G_t *grp = NULL; H5G_entry_t *loc = NULL; H5G_entry_t ent; - hid_t dxpl_id = H5AC_dxpl_id; /* dxpl to use to open group */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl to use to open group */ FUNC_ENTER_API(H5Gopen, FAIL); H5TRACE2("i","is",loc_id,name); @@ -298,7 +298,7 @@ H5Gopen(hid_t loc_id, const char *name) if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name"); - /* Open the object, making sure it's a group */ + /* Open the parent group, making sure it's a group */ if (H5G_find(loc, name, NULL, &ent/*out*/, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found"); @@ -1426,7 +1426,7 @@ H5G_namei(H5G_entry_t *loc_ent, const char *name, const char **rest/*out*/, unsigned null_grp; /* Flag to indicate this function was called with grp_ent set to NULL */ unsigned group_copy = 0; /* Flag to indicate that the group entry is copied */ unsigned last_comp = 0; /* Flag to indicate that a component is the last component in the name */ - unsigned did_insert = 0; /* Flag to indicate that H5G_stab_insert was called */ + unsigned did_insert = 0; /* Flag to indicate that H5G_stab_insert was called */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5G_namei); @@ -1587,7 +1587,7 @@ H5G_namei(H5G_entry_t *loc_ent, const char *name, const char **rest/*out*/, *rest = name; /*final null */ /* If this was an insert, make sure that the insert function was actually - * called (this catches no-op names like "/" and ".") */ + * called (this catches no-op names like "." and "/") */ if(action == H5G_NAMEI_INSERT && !did_insert) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group already exists"); @@ -1869,7 +1869,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CANTDELETE, NULL, "unable to delete object header"); } /* end if */ if(grp!=NULL) { - if(grp->shared!=NULL) + if(grp->shared != NULL) H5FL_FREE(H5G_shared_t, grp->shared); H5FL_FREE(H5G_t,grp); } @@ -2015,6 +2015,7 @@ H5G_open(H5G_entry_t *ent, hid_t dxpl_id) shared_fo->fo_count++; } + /* Set return value */ ret_value = grp; done: @@ -2177,7 +2178,6 @@ done: } - /*------------------------------------------------------------------------- * Function: H5G_free * @@ -2210,6 +2210,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } + /*------------------------------------------------------------------------- * Function: H5G_rootof * @@ -2282,13 +2283,13 @@ H5G_insert(H5G_entry_t *loc, const char *name, H5G_entry_t *ent, hid_t dxpl_id) * Lookup and insert the name -- it shouldn't exist yet. */ if (H5G_namei(loc, name, NULL, NULL, NULL, H5G_TARGET_NORMAL, NULL, H5G_NAMEI_INSERT, ent, dxpl_id)<0) - HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "already exists"); + HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "already exists"); /* * Insert the object into a symbol table. */ if (H5O_link(ent, 1, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_LINK, FAIL, "unable to increment hard link count"); + HGOTO_ERROR(H5E_SYM, H5E_LINK, FAIL, "unable to increment hard link count"); done: FUNC_LEAVE_NOAPI(ret_value); @@ -2897,7 +2898,7 @@ H5G_get_objtype_by_idx(H5G_entry_t *loc, hsize_t idx, hid_t dxpl_id) H5G_bt_ud3_t udata; /* User data for B-tree callback */ int ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5G_get_objtype_by_idx, FAIL); + FUNC_ENTER_NOAPI(H5G_get_objtype_by_idx, H5G_UNKNOWN); /* Sanity check */ assert(loc); @@ -2912,7 +2913,7 @@ H5G_get_objtype_by_idx(H5G_entry_t *loc, hsize_t idx, hid_t dxpl_id) /* Iterate over the group members */ if (H5B_iterate (loc->file, dxpl_id, H5B_SNODE, H5G_node_type, loc->cache.stab.btree_addr, &udata)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "iteration operator failed"); /* If we don't know the type now, we almost certainly went out of bounds */ if(udata.type==H5G_UNKNOWN) @@ -3035,7 +3036,7 @@ H5G_set_comment(H5G_entry_t *loc, const char *name, const char *buf, hid_t dxpl_ /* Add the new message */ if (buf && *buf) { comment.s = H5MM_xstrdup(buf); - if (H5O_modify(&obj_ent, H5O_NAME_ID, H5O_NEW_MESG, 0, 1, &comment, dxpl_id)<0) + if (H5O_modify(&obj_ent, H5O_NAME_ID, H5O_NEW_MESG, 0, H5O_UPDATE_TIME, &comment, dxpl_id)<0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment object header message"); H5O_reset(H5O_NAME_ID, &comment); } diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 4804cff..fcfcb35 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -109,7 +109,7 @@ H5G_stab_create(H5F_t *f, hid_t dxpl_id, size_t init, H5G_entry_t *self/*out*/) * Insert the symbol table message into the object header and the symbol * table entry. */ - if (H5O_modify(self, H5O_STAB_ID, H5O_NEW_MESG, H5O_FLAG_CONSTANT, 1, &stab, dxpl_id)<0) { + if (H5O_modify(self, H5O_STAB_ID, H5O_NEW_MESG, H5O_FLAG_CONSTANT, H5O_UPDATE_TIME, &stab, dxpl_id)<0) { H5O_close(self); HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message"); } diff --git a/src/H5O.c b/src/H5O.c index 396fed5..326be7d 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -64,7 +64,7 @@ static herr_t H5O_share(H5F_t *f, hid_t dxpl_id, const H5O_class_t *type, const static unsigned H5O_find_in_ohdr(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_class_t **type_p, int sequence); static int H5O_modify_real(H5G_entry_t *ent, const H5O_class_t *type, - int overwrite, unsigned flags, unsigned update_time, const void *mesg, + int overwrite, unsigned flags, unsigned update_flags, const void *mesg, hid_t dxpl_id); static int H5O_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_class_t *type, unsigned flags, const void *mesg); @@ -80,7 +80,7 @@ static unsigned H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *flags, const H5O_class_t *orig_type, const void *orig_mesg, H5O_shared_t *sh_mesg, const H5O_class_t **new_type, const void **new_mesg, hid_t dxpl_id); static herr_t H5O_write_mesg(H5O_t *oh, unsigned idx, const H5O_class_t *type, - const void *mesg, unsigned flags); + const void *mesg, unsigned flags, unsigned update_flags); /* Metadata cache callbacks */ static H5O_t *H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata1, @@ -1185,7 +1185,7 @@ H5O_copy_real (const H5O_class_t *type, const void *mesg, void *dst) assert (type->copy); if (mesg) { - if (NULL==(ret_value=(type->copy)(mesg, dst))) + if (NULL==(ret_value=(type->copy)(mesg, dst, 0))) HGOTO_ERROR (H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy object header message"); } @@ -1631,7 +1631,7 @@ H5O_read_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, void *mes * the raw message) so we must copy the native message before * returning. */ - if (NULL==(ret_value = (type->copy) (oh->mesg[idx].native, mesg))) + if (NULL==(ret_value = (type->copy) (oh->mesg[idx].native, mesg, 0))) HGOTO_ERROR (H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy message to user space"); } @@ -1694,11 +1694,10 @@ H5O_find_in_ohdr(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_class_t **type_p, * Decode the message if necessary. If the message is shared then decode * a shared message, ignoring the message type. */ - if (oh->mesg[u].flags & H5O_FLAG_SHARED) { + if (oh->mesg[u].flags & H5O_FLAG_SHARED) type = H5O_SHARED; - } else { + else type = oh->mesg[u].type; - } if (NULL == oh->mesg[u].native) { assert(type->decode); @@ -1769,7 +1768,7 @@ done: */ int H5O_modify(H5G_entry_t *ent, unsigned type_id, int overwrite, - unsigned flags, unsigned update_time, const void *mesg, hid_t dxpl_id) + unsigned flags, unsigned update_flags, const void *mesg, hid_t dxpl_id) { const H5O_class_t *type; /* Actual H5O class type for the ID */ int ret_value; /* Return value */ @@ -1787,7 +1786,7 @@ H5O_modify(H5G_entry_t *ent, unsigned type_id, int overwrite, assert (0==(flags & ~H5O_FLAG_BITS)); /* Call the "real" modify routine */ - if((ret_value= H5O_modify_real(ent, type, overwrite, flags, update_time, mesg, dxpl_id))<0) + if((ret_value= H5O_modify_real(ent, type, overwrite, flags, update_flags, mesg, dxpl_id))<0) HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header"); done: @@ -1838,7 +1837,7 @@ done: */ static int H5O_modify_real(H5G_entry_t *ent, const H5O_class_t *type, int overwrite, - unsigned flags, unsigned update_time, const void *mesg, hid_t dxpl_id) + unsigned flags, unsigned update_flags, const void *mesg, hid_t dxpl_id) { H5O_t *oh=NULL; int sequence; @@ -1896,11 +1895,11 @@ H5O_modify_real(H5G_entry_t *ent, const H5O_class_t *type, int overwrite, } /* Write the information to the message */ - if(H5O_write_mesg(oh,idx,type,mesg,flags)<0) + if(H5O_write_mesg(oh,idx,type,mesg,flags,update_flags)<0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message"); /* Update the modification time message if any */ - if(update_time) + if(update_flags&H5O_UPDATE_TIME) H5O_touch_oh(ent->file, oh, FALSE); /* Set return value */ @@ -2088,7 +2087,7 @@ H5O_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_class_t *type, HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create new message"); /* Write the information to the message */ - if(H5O_write_mesg(oh,idx,type,mesg,flags)<0) + if(H5O_write_mesg(oh,idx,type,mesg,flags,0)<0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message"); /* Set return value */ @@ -2191,7 +2190,7 @@ done: */ static herr_t H5O_write_mesg(H5O_t *oh, unsigned idx, const H5O_class_t *type, - const void *mesg, unsigned flags) + const void *mesg, unsigned flags, unsigned update_flags) { H5O_mesg_t *idx_msg; /* Pointer to message to modify */ herr_t ret_value=SUCCEED; /* Return value */ @@ -2207,10 +2206,11 @@ H5O_write_mesg(H5O_t *oh, unsigned idx, const H5O_class_t *type, idx_msg=&oh->mesg[idx]; /* Reset existing native information */ - H5O_reset_real(type, idx_msg->native); + if(!(update_flags&H5O_UPDATE_DATA_ONLY)) + H5O_reset_real(type, idx_msg->native); /* Copy the native value for the message */ - if (NULL == (idx_msg->native = (type->copy) (mesg, idx_msg->native))) + if (NULL == (idx_msg->native = (type->copy) (mesg, idx_msg->native, update_flags))) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy message to object header"); idx_msg->flags = flags; @@ -3431,6 +3431,102 @@ done: /*------------------------------------------------------------------------- + * Function: H5O_iterate + * + * Purpose: Iterate through object headers of a certain type. + * + * Return: Returns a negative value if something is wrong, the return + * value of the last operator if it was non-zero, or zero if all + * object headers were processed. + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Nov 19 2004 + * + * Description: + * This function interates over the object headers of an object + * specified with 'ent' of type 'type_id'. For each object header of the + * object, the 'op_data' and some additional information (specified below) are + * passed to the 'op' function. + * The operation receives a pointer to the object header message for the + * object being iterated over ('mesg'), and the pointer to the operator data + * passed in to H5O_iterate ('op_data'). The return values from an operator + * are: + * A. Zero causes the iterator to continue, returning zero when all + * object headers of that type have been processed. + * B. Positive causes the iterator to immediately return that positive + * value, indicating short-circuit success. + * C. Negative causes the iterator to immediately return that value, + * indicating failure. + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5O_iterate(const H5G_entry_t *ent, unsigned type_id, H5O_operator_t op, + void *op_data, hid_t dxpl_id) +{ + H5O_t *oh=NULL; /* Pointer to actual object header */ + const H5O_class_t *type; /* Actual H5O class type for the ID */ + unsigned idx; /* Absolute index of current message in all messages */ + unsigned sequence; /* Relative index of current message for messages of type */ + H5O_mesg_t *idx_msg; /* Pointer to current message */ + herr_t ret_value=0; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_iterate, FAIL); + + /* check args */ + assert(ent); + assert(ent->file); + assert(H5F_addr_defined(ent->header)); + assert(type_idfile, dxpl_id, H5AC_OHDR, ent->header, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header"); + + /* Iterate over messages */ + for (sequence=0, idx = 0, idx_msg=&oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) { + if (type->id == idx_msg->type->id) { + /* + * Decode the message if necessary. If the message is shared then decode + * a shared message, ignoring the message type. + */ + if (NULL == idx_msg->native) { + const H5O_class_t *decode_type; + + if (idx_msg->flags & H5O_FLAG_SHARED) + decode_type = H5O_SHARED; + else + decode_type = type; + + /* Decode the message if necessary */ + assert(decode_type->decode); + if (NULL == (idx_msg->native = (decode_type->decode) (ent->file, dxpl_id, idx_msg->raw, NULL))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode message"); + } /* end if */ + + /* Call the iterator callback */ + if((ret_value=(op)(idx_msg->native,sequence,op_data))!=0) + break; + + /* Increment sequence value for message type */ + sequence++; + } /* end if */ + } /* end for */ + +done: + if (oh && H5AC_unprotect(ent->file, dxpl_id, H5AC_OHDR, ent->header, oh, FALSE) < 0) + HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); + + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5O_iterate() */ + + +/*------------------------------------------------------------------------- * Function: H5O_debug_id * * Purpose: Act as a proxy for calling the 'debug' method for a diff --git a/src/H5Oattr.c b/src/H5Oattr.c index bb22f70..7e4314e 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -32,7 +32,7 @@ /* PRIVATE PROTOTYPES */ static herr_t H5O_attr_encode (H5F_t *f, uint8_t *p, const void *mesg); static void *H5O_attr_decode (H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); -static void *H5O_attr_copy (const void *_mesg, void *_dest); +static void *H5O_attr_copy (const void *_mesg, void *_dest, unsigned update_flags); static size_t H5O_attr_size (H5F_t *f, const void *_mesg); static herr_t H5O_attr_reset (void *_mesg); static herr_t H5O_attr_free (void *mesg); @@ -69,7 +69,6 @@ const H5O_class_t H5O_ATTR[1] = {{ #define H5O_ATTR_FLAG_TYPE_SHARED 0x01 /* Interface initialization */ -static int interface_initialize_g = 0; #define INTERFACE_INIT NULL /* Declare extern the free list for H5A_t's */ @@ -372,8 +371,8 @@ done: This function copies a native (memory) attribute message, allocating the destination structure if necessary. --------------------------------------------------------------------------*/ -static void * -H5O_attr_copy(const void *_src, void *_dst) +static void * +H5O_attr_copy(const void *_src, void *_dst, unsigned update_flags) { const H5A_t *src = (const H5A_t *) _src; void *ret_value; /* Return value */ @@ -384,7 +383,7 @@ H5O_attr_copy(const void *_src, void *_dst) assert(src); /* copy */ - if (NULL == (ret_value = H5A_copy(_dst,src))) + if (NULL == (ret_value = H5A_copy(_dst,src,update_flags))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "can't copy attribute"); done: @@ -485,7 +484,7 @@ H5O_attr_reset(void *_mesg) H5A_t *attr = (H5A_t *) _mesg; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5O_attr_reset); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_reset); if (attr) H5A_free(attr); diff --git a/src/H5Ocont.c b/src/H5Ocont.c index 8cc1a95..47a1d03 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -64,7 +64,6 @@ const H5O_class_t H5O_CONT[1] = {{ }}; /* Interface initialization */ -static int interface_initialize_g = 0; #define INTERFACE_INIT NULL /* Declare the free list for H5O_cont_t's */ diff --git a/src/H5Odtype.c b/src/H5Odtype.c index a62baa8..7579d70 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -28,7 +28,7 @@ /* PRIVATE PROTOTYPES */ static herr_t H5O_dtype_encode (H5F_t *f, uint8_t *p, const void *mesg); static void *H5O_dtype_decode (H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); -static void *H5O_dtype_copy (const void *_mesg, void *_dest); +static void *H5O_dtype_copy (const void *_mesg, void *_dest, unsigned update_flags); static size_t H5O_dtype_size (H5F_t *f, const void *_mesg); static herr_t H5O_dtype_reset (void *_mesg); static herr_t H5O_dtype_free (void *_mesg); @@ -67,7 +67,6 @@ const H5O_class_t H5O_DTYPE[1] = {{ #define H5O_DTYPE_VERSION_UPDATED 2 /* Interface initialization */ -static int interface_initialize_g = 0; #define INTERFACE_INIT NULL /* Declare external the free list for H5T_t's */ @@ -930,7 +929,7 @@ done: allocating the destination structure if necessary. --------------------------------------------------------------------------*/ static void * -H5O_dtype_copy(const void *_src, void *_dst) +H5O_dtype_copy(const void *_src, void *_dst, unsigned UNUSED update_flags) { const H5T_t *src = (const H5T_t *) _src; H5T_t *dst = NULL; diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 091dd42..0f53058 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -33,7 +33,7 @@ /* PRIVATE PROTOTYPES */ static void *H5O_efl_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_efl_encode(H5F_t *f, uint8_t *p, const void *_mesg); -static void *H5O_efl_copy(const void *_mesg, void *_dest); +static void *H5O_efl_copy(const void *_mesg, void *_dest, unsigned update_flags); static size_t H5O_efl_size(H5F_t *f, const void *_mesg); static herr_t H5O_efl_reset(void *_mesg); static herr_t H5O_efl_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, @@ -60,7 +60,6 @@ const H5O_class_t H5O_EFL[1] = {{ #define H5O_EFL_VERSION 1 /* Interface initialization */ -static int interface_initialize_g = 0; #define INTERFACE_INIT NULL @@ -259,7 +258,7 @@ H5O_efl_encode(H5F_t *f, uint8_t *p, const void *_mesg) *------------------------------------------------------------------------- */ static void * -H5O_efl_copy(const void *_mesg, void *_dest) +H5O_efl_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags) { const H5O_efl_t *mesg = (const H5O_efl_t *) _mesg; H5O_efl_t *dest = (H5O_efl_t *) _dest; 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, "\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, "\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) { diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 1918924..4a19b5b 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -20,6 +20,10 @@ #define H5O_PACKAGE /*suppress error about including H5Opkg */ +/* Pablo information */ +/* (Put before include files to avoid problems with inline functions) */ +#define PABLO_MASK H5O_layout_mask + #include "H5private.h" #include "H5Dprivate.h" #include "H5Eprivate.h" @@ -31,7 +35,7 @@ /* PRIVATE PROTOTYPES */ static void *H5O_layout_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_layout_encode(H5F_t *f, uint8_t *p, const void *_mesg); -static void *H5O_layout_copy(const void *_mesg, void *_dest); +static void *H5O_layout_copy(const void *_mesg, void *_dest, unsigned update_flags); static size_t H5O_layout_size(H5F_t *f, const void *_mesg); static herr_t H5O_layout_reset (void *_mesg); static herr_t H5O_layout_free (void *_mesg); @@ -65,8 +69,6 @@ const H5O_class_t H5O_LAYOUT[1] = {{ #define H5O_LAYOUT_VERSION_3 3 /* Interface initialization */ -#define PABLO_MASK H5O_layout_mask -static int interface_initialize_g = 0; #define INTERFACE_INIT NULL /* Declare a free list to manage the H5O_layout_t struct */ @@ -103,7 +105,7 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p, H5O_shared_t unsigned u; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_layout_decode, NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_layout_decode); /* check args */ assert(f); @@ -257,7 +259,7 @@ H5O_layout_encode(H5F_t *f, uint8_t *p, const void *_mesg) unsigned u; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_layout_encode, FAIL); + FUNC_ENTER_NOAPI_NOINIT(H5O_layout_encode); /* check args */ assert(f); @@ -372,13 +374,13 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_layout_copy(const void *_mesg, void *_dest) +H5O_layout_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags) { const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; H5O_layout_t *dest = (H5O_layout_t *) _dest; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_layout_copy, NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_layout_copy); /* check args */ assert(mesg); @@ -431,7 +433,7 @@ H5O_layout_meta_size(H5F_t *f, const void *_mesg) H5O_layout_t *mesg = (H5O_layout_t *) _mesg; size_t ret_value; - FUNC_ENTER_NOAPI(H5O_layout_meta_size, 0); + FUNC_ENTER_NOAPI_NOINIT(H5O_layout_meta_size); /* check args */ assert(f); @@ -539,7 +541,7 @@ H5O_layout_size(H5F_t *f, const void *_mesg) const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; size_t ret_value; - FUNC_ENTER_NOAPI(H5O_layout_size, 0); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_layout_size); /* check args */ assert(f); @@ -548,7 +550,7 @@ H5O_layout_size(H5F_t *f, const void *_mesg) ret_value = H5O_layout_meta_size(f, mesg); if(mesg->type==H5D_COMPACT) ret_value += mesg->u.compact.size;/* data for compact dataset */ -done: + FUNC_LEAVE_NOAPI(ret_value); } @@ -572,9 +574,8 @@ static herr_t H5O_layout_reset (void *_mesg) { H5O_layout_t *mesg = (H5O_layout_t *) _mesg; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_layout_reset, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_layout_reset); if(mesg) { /* Free the compact storage buffer */ @@ -586,8 +587,7 @@ H5O_layout_reset (void *_mesg) mesg->version=0; } /* end if */ -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -609,9 +609,8 @@ static herr_t H5O_layout_free (void *_mesg) { H5O_layout_t *mesg = (H5O_layout_t *) _mesg; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_layout_free, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_layout_free); assert (mesg); @@ -621,8 +620,7 @@ H5O_layout_free (void *_mesg) H5FL_FREE(H5O_layout_t,mesg); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -646,7 +644,7 @@ H5O_layout_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg) const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_layout_delete, FAIL); + FUNC_ENTER_NOAPI_NOINIT(H5O_layout_delete); /* check args */ assert(f); @@ -699,9 +697,8 @@ H5O_layout_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE { const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; unsigned u; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_layout_debug, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_layout_debug); /* check args */ assert(f); @@ -735,6 +732,5 @@ H5O_layout_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE "Data Size:", mesg->u.compact.size); } /* end else */ -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } diff --git a/src/H5Omtime.c b/src/H5Omtime.c index 05052cf..c272d05 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -39,7 +39,7 @@ static size_t H5O_mtime_new_size(H5F_t *f, const void *_mesg); static void *H5O_mtime_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_mtime_encode(H5F_t *f, uint8_t *p, const void *_mesg); -static void *H5O_mtime_copy(const void *_mesg, void *_dest); +static void *H5O_mtime_copy(const void *_mesg, void *_dest, unsigned update_flags); static size_t H5O_mtime_size(H5F_t *f, const void *_mesg); static herr_t H5O_mtime_reset(void *_mesg); static herr_t H5O_mtime_free(void *_mesg); @@ -84,7 +84,6 @@ const H5O_class_t H5O_MTIME_NEW[1] = {{ }}; /* Interface initialization */ -static int interface_initialize_g = 0; #define INTERFACE_INIT NULL /* Current version of new mtime information */ @@ -124,7 +123,7 @@ H5O_mtime_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p, int version; /* Version of mtime information */ void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_mtime_new_decode, NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_mtime_new_decode); /* check args */ assert(f); @@ -170,6 +169,8 @@ done: * matzke@llnl.gov * Jul 24 1998 * + * Modifications: + * *------------------------------------------------------------------------- */ static void * @@ -181,7 +182,7 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p, struct tm tm; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_mtime_decode, NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_mtime_decode); /* check args */ assert(f); @@ -239,7 +240,7 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p, #elif defined(H5_HAVE_GETTIMEOFDAY) && defined(H5_HAVE_STRUCT_TIMEZONE) && defined(H5_GETTIMEOFDAY_GIVES_TZ) { struct timezone tz; - struct timeval tv; /* Used as a placebo; some systems don't like NULL */ + struct timeval tv; /* Used as a placebo; some systems don't like NULL */ if (HDgettimeofday(&tv, &tz) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information"); @@ -308,9 +309,8 @@ static herr_t H5O_mtime_new_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg) { const time_t *mesg = (const time_t *) _mesg; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_mtime_new_encode, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_mtime_new_encode); /* check args */ assert(f); @@ -328,8 +328,7 @@ H5O_mtime_new_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg) /* Encode time */ UINT32ENCODE(p, *mesg); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } /* end H5O_mtime_new_encode() */ @@ -353,9 +352,8 @@ H5O_mtime_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg) { const time_t *mesg = (const time_t *) _mesg; struct tm *tm; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_mtime_encode, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_mtime_encode); /* check args */ assert(f); @@ -368,8 +366,7 @@ H5O_mtime_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg) 1900+tm->tm_year, 1+tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -392,13 +389,13 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_mtime_copy(const void *_mesg, void *_dest) +H5O_mtime_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags) { const time_t *mesg = (const time_t *) _mesg; time_t *dest = (time_t *) _dest; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_mtime_copy, NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_mtime_copy); /* check args */ assert(mesg); @@ -439,16 +436,13 @@ done: static size_t H5O_mtime_new_size(H5F_t UNUSED * f, const void UNUSED * mesg) { - size_t ret_value=8; /* Return value */ - - FUNC_ENTER_NOAPI(H5O_mtime_new_size, 0); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_mtime_new_size); /* check args */ assert(f); assert(mesg); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(8); } /* end H5O_mtime_new_size() */ @@ -475,16 +469,13 @@ done: static size_t H5O_mtime_size(H5F_t UNUSED * f, const void UNUSED * mesg) { - size_t ret_value=16; /* Return value */ - - FUNC_ENTER_NOAPI(H5O_mtime_size, 0); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_mtime_size); /* check args */ assert(f); assert(mesg); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(16); } @@ -506,12 +497,9 @@ done: static herr_t H5O_mtime_reset(void UNUSED *_mesg) { - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5O_mtime_reset, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_mtime_reset); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -532,16 +520,13 @@ done: static herr_t H5O_mtime_free (void *mesg) { - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5O_mtime_free, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_mtime_free); assert (mesg); H5FL_FREE(time_t,mesg); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -567,9 +552,8 @@ H5O_mtime_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE * const time_t *mesg = (const time_t *)_mesg; struct tm *tm; char buf[128]; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_mtime_debug, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_mtime_debug); /* check args */ assert(f); @@ -585,7 +569,6 @@ H5O_mtime_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE * fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Time:", buf); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } diff --git a/src/H5Oname.c b/src/H5Oname.c index 231a177..04a5a03 100644 --- a/src/H5Oname.c +++ b/src/H5Oname.c @@ -37,7 +37,7 @@ /* PRIVATE PROTOTYPES */ static void *H5O_name_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_name_encode(H5F_t *f, uint8_t *p, const void *_mesg); -static void *H5O_name_copy(const void *_mesg, void *_dest); +static void *H5O_name_copy(const void *_mesg, void *_dest, unsigned update_flags); static size_t H5O_name_size(H5F_t *f, const void *_mesg); static herr_t H5O_name_reset(void *_mesg); static herr_t H5O_name_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, @@ -62,7 +62,6 @@ const H5O_class_t H5O_NAME[1] = {{ }}; /* Interface initialization */ -static int interface_initialize_g = 0; #define INTERFACE_INIT NULL @@ -91,7 +90,7 @@ H5O_name_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p, H5O_name_t *mesg; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_name_decode, NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_name_decode); /* check args */ assert(f); @@ -136,9 +135,8 @@ static herr_t H5O_name_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg) { const H5O_name_t *mesg = (const H5O_name_t *) _mesg; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_name_encode, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_name_encode); /* check args */ assert(f); @@ -148,8 +146,7 @@ H5O_name_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg) /* encode */ HDstrcpy((char*)p, mesg->s); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -172,13 +169,13 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_name_copy(const void *_mesg, void *_dest) +H5O_name_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags) { const H5O_name_t *mesg = (const H5O_name_t *) _mesg; H5O_name_t *dest = (H5O_name_t *) _dest; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_name_copy, NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_name_copy); /* check args */ assert(mesg); @@ -224,7 +221,7 @@ H5O_name_size(H5F_t UNUSED *f, const void *_mesg) const H5O_name_t *mesg = (const H5O_name_t *) _mesg; size_t ret_value; - FUNC_ENTER_NOAPI(H5O_name_size, 0); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_name_size); /* check args */ assert(f); @@ -232,7 +229,6 @@ H5O_name_size(H5F_t UNUSED *f, const void *_mesg) ret_value = mesg->s ? HDstrlen(mesg->s) + 1 : 0; -done: FUNC_LEAVE_NOAPI(ret_value); } @@ -257,9 +253,8 @@ static herr_t H5O_name_reset(void *_mesg) { H5O_name_t *mesg = (H5O_name_t *) _mesg; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_name_reset, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_name_reset); /* check args */ assert(mesg); @@ -267,8 +262,7 @@ H5O_name_reset(void *_mesg) /* reset */ mesg->s = H5MM_xfree(mesg->s); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -292,9 +286,8 @@ H5O_name_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *s int indent, int fwidth) { const H5O_name_t *mesg = (const H5O_name_t *)_mesg; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_name_debug, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_name_debug); /* check args */ assert(f); @@ -307,6 +300,5 @@ H5O_name_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *s "Name:", mesg->s); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 866e1b7..6ddfd92 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -62,7 +62,7 @@ typedef struct H5O_class_t { size_t native_size; /*size of native message */ void *(*decode)(H5F_t*, hid_t, const uint8_t*, struct H5O_shared_t*); herr_t (*encode)(H5F_t*, uint8_t*, const void*); - void *(*copy)(const void*, void*); /*copy native value */ + void *(*copy)(const void*, void*, unsigned); /*copy native value */ size_t (*raw_size)(H5F_t*, const void*);/*sizeof raw val */ herr_t (*reset)(void *); /*free nested data structs */ herr_t (*free)(void *); /*free main data struct */ diff --git a/src/H5Opline.c b/src/H5Opline.c index 5240f72..e4101cd 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -31,14 +31,13 @@ #define PABLO_MASK H5O_pline_mask /* Interface initialization */ -static int interface_initialize_g = 0; #define INTERFACE_INIT NULL #define H5O_PLINE_VERSION 1 static herr_t H5O_pline_encode (H5F_t *f, uint8_t *p, const void *mesg); static void *H5O_pline_decode (H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); -static void *H5O_pline_copy (const void *_mesg, void *_dest); +static void *H5O_pline_copy (const void *_mesg, void *_dest, unsigned update_flags); static size_t H5O_pline_size (H5F_t *f, const void *_mesg); static herr_t H5O_pline_reset (void *_mesg); static herr_t H5O_pline_free (void *_mesg); @@ -93,7 +92,7 @@ H5O_pline_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p, unsigned version; size_t i, j, n, name_length; - FUNC_ENTER_NOAPI(H5O_pline_decode, NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_pline_decode); /* check args */ assert(p); @@ -184,9 +183,8 @@ H5O_pline_encode (H5F_t UNUSED *f, uint8_t *p/*out*/, const void *mesg) size_t i, j, name_length; const char *name=NULL; H5Z_class_t *cls=NULL; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_pline_encode, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_pline_encode); /* Check args */ assert (p); @@ -229,8 +227,7 @@ H5O_pline_encode (H5F_t UNUSED *f, uint8_t *p/*out*/, const void *mesg) UINT32ENCODE(p, 0); } -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -253,14 +250,14 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_pline_copy (const void *_src, void *_dst/*out*/) +H5O_pline_copy (const void *_src, void *_dst/*out*/, unsigned UNUSED update_flags) { const H5O_pline_t *src = (const H5O_pline_t *)_src; H5O_pline_t *dst = (H5O_pline_t *)_dst; size_t i; - H5O_pline_t *ret_value = NULL; + H5O_pline_t *ret_value; - FUNC_ENTER_NOAPI(H5O_pline_copy, NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_pline_copy); if (!dst && NULL==(dst = H5FL_MALLOC (H5O_pline_t))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); @@ -330,15 +327,15 @@ static size_t H5O_pline_size (H5F_t UNUSED *f, const void *mesg) { const H5O_pline_t *pline = (const H5O_pline_t*)mesg; - size_t i, size, name_len; + size_t i, name_len; const char *name = NULL; H5Z_class_t *cls = NULL; size_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_pline_size, 0); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_pline_size); /* Message header */ - size = 1 + /*version */ + ret_value = 1 + /*version */ 1 + /*number of filters */ 6; /*reserved */ @@ -350,21 +347,17 @@ H5O_pline_size (H5F_t UNUSED *f, const void *mesg) name_len = name ? HDstrlen(name)+1 : 0; - size += 2 + /*filter identification number */ + ret_value += 2 + /*filter identification number */ 2 + /*name length */ 2 + /*flags */ 2 + /*number of client data values */ H5O_ALIGN(name_len); /*length of the filter name */ - size += pline->filter[i].cd_nelmts * 4; + ret_value += pline->filter[i].cd_nelmts * 4; if (pline->filter[i].cd_nelmts % 2) - size += 4; + ret_value += 4; } - /* Set return value */ - ret_value=size; - -done: FUNC_LEAVE_NOAPI(ret_value); } @@ -389,9 +382,8 @@ H5O_pline_reset (void *mesg) { H5O_pline_t *pline = (H5O_pline_t*)mesg; size_t i; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_pline_reset, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_pline_reset); assert (pline); @@ -403,8 +395,7 @@ H5O_pline_reset (void *mesg) H5MM_xfree(pline->filter); HDmemset(pline, 0, sizeof *pline); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -425,16 +416,13 @@ done: static herr_t H5O_pline_free (void *mesg) { - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5O_pline_free, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_pline_free); assert (mesg); H5FL_FREE(H5O_pline_t,mesg); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -460,9 +448,8 @@ H5O_pline_debug (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *mesg, FILE * { const H5O_pline_t *pline = (const H5O_pline_t *)mesg; size_t i, j; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_pline_debug, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_pline_debug); /* check args */ assert(f); @@ -506,6 +493,5 @@ H5O_pline_debug (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *mesg, FILE * } } -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 4d7c36b..e32a734 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -49,6 +49,10 @@ #define H5O_FLAG_SHARED 0x02u #define H5O_FLAG_BITS (H5O_FLAG_CONSTANT|H5O_FLAG_SHARED) +/* Flags for updating messages */ +#define H5O_UPDATE_TIME 0x01u +#define H5O_UPDATE_DATA_ONLY 0x02u + /* Header message IDs */ #define H5O_NULL_ID 0x0000 /* Null Message. */ #define H5O_SDSPACE_ID 0x0001 /* Simple Dataspace Message. */ @@ -225,6 +229,10 @@ typedef struct H5O_stab_t { haddr_t heap_addr; /*address of name heap */ } H5O_stab_t; +/* Typedef for iteration operations */ +typedef herr_t (*H5O_operator_t)(const void *mesg/*in*/, unsigned idx, + void *operator_data/*in,out*/); + /* General message operators */ H5_DLL herr_t H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, H5G_entry_t *ent/*out*/); @@ -237,7 +245,7 @@ H5_DLL htri_t H5O_exists(H5G_entry_t *ent, unsigned type_id, int sequence, H5_DLL void *H5O_read(H5G_entry_t *ent, unsigned type_id, int sequence, void *mesg, hid_t dxpl_id); H5_DLL int H5O_modify(H5G_entry_t *ent, unsigned type_id, - int overwrite, unsigned flags, unsigned update_time, const void *mesg, hid_t dxpl_id); + int overwrite, unsigned flags, unsigned update_flags, const void *mesg, hid_t dxpl_id); H5_DLL struct H5O_t * H5O_protect(H5G_entry_t *ent, hid_t dxpl_id); H5_DLL herr_t H5O_unprotect(H5G_entry_t *ent, struct H5O_t *oh, hid_t dxpl_id); H5_DLL int H5O_append(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh, unsigned type_id, @@ -257,6 +265,8 @@ H5_DLL size_t H5O_raw_size(unsigned type_id, H5F_t *f, const void *mesg); H5_DLL herr_t H5O_get_share(unsigned type_id, H5F_t *f, const void *mesg, H5O_shared_t *share); H5_DLL herr_t H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr); H5_DLL herr_t H5O_get_info(H5G_entry_t *ent, H5O_stat_t *ostat, hid_t dxpl_id); +H5_DLL herr_t H5O_iterate(const H5G_entry_t *ent, unsigned type_id, H5O_operator_t op, + void *op_data, hid_t dxpl_id); H5_DLL herr_t H5O_debug_id(hid_t type_id, H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, int indent, int fwidth); H5_DLL herr_t H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth); diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 0cfe6ba..8150a88 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -28,7 +28,7 @@ /* PRIVATE PROTOTYPES */ static void *H5O_sdspace_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg); -static void *H5O_sdspace_copy(const void *_mesg, void *_dest); +static void *H5O_sdspace_copy(const void *_mesg, void *_dest, unsigned update_flags); static size_t H5O_sdspace_size(H5F_t *f, const void *_mesg); static herr_t H5O_sdspace_reset(void *_mesg); static herr_t H5O_sdspace_free (void *_mesg); @@ -56,7 +56,6 @@ const H5O_class_t H5O_SDSPACE[1] = {{ #define H5O_SDSPACE_VERSION 1 /* Is the interface initialized? */ -static int interface_initialize_g = 0; #define INTERFACE_INIT NULL /* Declare external the free list for H5S_extent_t's */ @@ -100,7 +99,7 @@ H5O_sdspace_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p, H5O_shared_ unsigned i; /* local counting variable */ unsigned flags, version; - FUNC_ENTER_NOAPI(H5O_sdspace_decode, NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_sdspace_decode); /* check args */ assert(f); @@ -192,9 +191,8 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *mesg) const H5S_extent_t *sdim = (const H5S_extent_t *) mesg; unsigned u; /* Local counting variable */ unsigned flags = 0; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_sdspace_encode, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_sdspace_encode); /* check args */ assert(f); @@ -224,8 +222,7 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *mesg) } } -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -245,13 +242,13 @@ done: allocating the destination structure if necessary. --------------------------------------------------------------------------*/ static void * -H5O_sdspace_copy(const void *mesg, void *dest) +H5O_sdspace_copy(const void *mesg, void *dest, unsigned UNUSED update_flags) { const H5S_extent_t *src = (const H5S_extent_t *) mesg; H5S_extent_t *dst = (H5S_extent_t *) dest; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_sdspace_copy, NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_sdspace_copy); /* check args */ assert(src); @@ -301,7 +298,7 @@ H5O_sdspace_size(H5F_t *f, const void *mesg) */ size_t ret_value = 8; - FUNC_ENTER_NOAPI(H5O_sdspace_size, 0); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_sdspace_size); /* add in the dimension sizes */ ret_value += space->rank * H5F_SIZEOF_SIZE (f); @@ -309,7 +306,6 @@ H5O_sdspace_size(H5F_t *f, const void *mesg) /* add in the space for the maximum dimensions, if they are present */ ret_value += space->max ? space->rank * H5F_SIZEOF_SIZE (f) : 0; -done: FUNC_LEAVE_NOAPI(ret_value); } @@ -333,14 +329,12 @@ static herr_t H5O_sdspace_reset(void *_mesg) { H5S_extent_t *mesg = (H5S_extent_t*)_mesg; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_sdspace_reset, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_sdspace_reset); H5S_extent_release(mesg); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -361,16 +355,13 @@ done: static herr_t H5O_sdspace_free (void *mesg) { - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5O_sdspace_free, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_sdspace_free); assert (mesg); H5FL_FREE(H5S_extent_t,mesg); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -398,9 +389,8 @@ H5O_sdspace_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *mesg, { const H5S_extent_t *sdim = (const H5S_extent_t *) mesg; unsigned u; /* local counting variable */ - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_sdspace_debug, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_sdspace_debug); /* check args */ assert(f); @@ -435,6 +425,5 @@ H5O_sdspace_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *mesg, } } /* end if */ -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } diff --git a/src/H5Oshared.c b/src/H5Oshared.c index f4d062a..92d959b 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -28,6 +28,10 @@ #define H5F_PACKAGE /*suppress error about including H5Fpkg */ #define H5O_PACKAGE /*suppress error about including H5Opkg */ +/* Pablo information */ +/* (Put before include files to avoid problems with inline functions) */ +#define PABLO_MASK H5O_shared_mask + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ @@ -37,7 +41,7 @@ static void *H5O_shared_decode (H5F_t*, hid_t dxpl_id, const uint8_t*, H5O_shared_t *sh); static herr_t H5O_shared_encode (H5F_t*, uint8_t*, const void*); -static void *H5O_shared_copy(const void *_mesg, void *_dest); +static void *H5O_shared_copy(const void *_mesg, void *_dest, unsigned update_flags); static size_t H5O_shared_size (H5F_t*, const void *_mesg); static herr_t H5O_shared_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg); static herr_t H5O_shared_link(H5F_t *f, hid_t dxpl_id, const void *_mesg); @@ -68,8 +72,6 @@ const H5O_class_t H5O_SHARED[1] = {{ #define H5O_SHARED_VERSION 2 /* Interface initialization */ -#define PABLO_MASK H5O_shared_mask -static int interface_initialize_g = 0; #define INTERFACE_INIT NULL @@ -99,7 +101,7 @@ H5O_shared_read(H5F_t *f, hid_t dxpl_id, H5O_shared_t *shared, const H5O_class_t { void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(H5O_shared_read,NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_shared_read); /* check args */ assert(f); @@ -158,7 +160,7 @@ H5O_shared_link_adj(H5F_t *f, hid_t dxpl_id, const H5O_shared_t *shared, int adj { int ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_shared_link_adj,FAIL); + FUNC_ENTER_NOAPI_NOINIT(H5O_shared_link_adj); /* check args */ assert(f); @@ -214,7 +216,7 @@ H5O_shared_decode (H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *buf, H5O_share unsigned flags, version; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_shared_decode, NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_shared_decode); /* Check args */ assert (f); @@ -230,7 +232,7 @@ H5O_shared_decode (H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *buf, H5O_share if (version!=H5O_SHARED_VERSION_1 && version!=H5O_SHARED_VERSION) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for shared object message"); - /* Flags */ + /* Get the shared information flags */ flags = *buf++; mesg->in_gh = (flags & 0x01); @@ -287,9 +289,8 @@ H5O_shared_encode (H5F_t *f, uint8_t *buf/*out*/, const void *_mesg) { const H5O_shared_t *mesg = (const H5O_shared_t *)_mesg; unsigned flags; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_shared_encode, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_shared_encode); /* Check args */ assert (f); @@ -323,8 +324,7 @@ H5O_shared_encode (H5F_t *f, uint8_t *buf/*out*/, const void *_mesg) H5F_addr_encode (f, &buf, mesg->u.ent.header); #endif /* OLD_WAY */ -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -347,13 +347,13 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_shared_copy(const void *_mesg, void *_dest) +H5O_shared_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags) { const H5O_shared_t *mesg = (const H5O_shared_t *) _mesg; H5O_shared_t *dest = (H5O_shared_t *) _dest; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_shared_copy, NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_shared_copy); /* check args */ assert(mesg); @@ -393,7 +393,7 @@ H5O_shared_size (H5F_t *f, const void *_mesg) const H5O_shared_t *shared = (const H5O_shared_t *) _mesg; size_t ret_value; - FUNC_ENTER_NOAPI(H5O_shared_size, 0); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_shared_size); ret_value = 1 + /*version */ 1 + /*the flags field */ @@ -401,7 +401,6 @@ H5O_shared_size (H5F_t *f, const void *_mesg) (H5F_SIZEOF_ADDR(f)+4) : /*sharing via global heap */ H5F_SIZEOF_ADDR(f)); /*sharing by another obj hdr */ -done: FUNC_LEAVE_NOAPI(ret_value); } @@ -426,7 +425,7 @@ H5O_shared_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg) const H5O_shared_t *shared = (const H5O_shared_t *) _mesg; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_shared_delete, FAIL); + FUNC_ENTER_NOAPI_NOINIT(H5O_shared_delete); /* check args */ assert(f); @@ -462,7 +461,7 @@ H5O_shared_link(H5F_t *f, hid_t dxpl_id, const void *_mesg) const H5O_shared_t *shared = (const H5O_shared_t *) _mesg; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_shared_link, FAIL); + FUNC_ENTER_NOAPI_NOINIT(H5O_shared_link); /* check args */ assert(f); @@ -496,9 +495,8 @@ H5O_shared_debug (H5F_t UNUSED *f, hid_t dxpl_id, const void *_mesg, FILE *stream, int indent, int fwidth) { const H5O_shared_t *mesg = (const H5O_shared_t *)_mesg; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_shared_debug, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_shared_debug); /* Check args */ assert (f); @@ -525,6 +523,5 @@ H5O_shared_debug (H5F_t UNUSED *f, hid_t dxpl_id, const void *_mesg, HADDR_UNDEF); } -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 8b33884..3b8dec6 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -40,7 +40,7 @@ /* PRIVATE PROTOTYPES */ static void *H5O_stab_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_stab_encode(H5F_t *f, uint8_t *p, const void *_mesg); -static void *H5O_stab_copy(const void *_mesg, void *_dest); +static void *H5O_stab_copy(const void *_mesg, void *_dest, unsigned update_flags); static size_t H5O_stab_size(H5F_t *f, const void *_mesg); static herr_t H5O_stab_free (void *_mesg); static herr_t H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg); @@ -66,7 +66,6 @@ const H5O_class_t H5O_STAB[1] = {{ }}; /* Interface initialization */ -static int interface_initialize_g = 0; #define INTERFACE_INIT NULL /* Declare a free list to manage the H5O_stab_t struct */ @@ -97,7 +96,7 @@ H5O_stab_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p, H5O_shared_t U H5O_stab_t *stab=NULL; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_stab_decode, NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_stab_decode); /* check args */ assert(f); @@ -142,9 +141,8 @@ static herr_t H5O_stab_encode(H5F_t *f, uint8_t *p, const void *_mesg) { const H5O_stab_t *stab = (const H5O_stab_t *) _mesg; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_stab_encode, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_stab_encode); /* check args */ assert(f); @@ -155,8 +153,7 @@ H5O_stab_encode(H5F_t *f, uint8_t *p, const void *_mesg) H5F_addr_encode(f, &p, stab->btree_addr); H5F_addr_encode(f, &p, stab->heap_addr); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -185,7 +182,7 @@ H5O_stab_fast(const H5G_cache_t *cache, const H5O_class_t *type, void *_mesg) H5O_stab_t *stab = NULL; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_stab_fast, NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_stab_fast); /* check args */ assert(cache); @@ -228,13 +225,13 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_stab_copy(const void *_mesg, void *_dest) +H5O_stab_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags) { const H5O_stab_t *stab = (const H5O_stab_t *) _mesg; H5O_stab_t *dest = (H5O_stab_t *) _dest; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_stab_copy, NULL); + FUNC_ENTER_NOAPI_NOINIT(H5O_stab_copy); /* check args */ assert(stab); @@ -276,12 +273,11 @@ H5O_stab_size(H5F_t *f, const void UNUSED *_mesg) { size_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_stab_size, 0); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_stab_size); /* Set return value */ ret_value=2 * H5F_SIZEOF_ADDR(f); -done: FUNC_LEAVE_NOAPI(ret_value); } @@ -303,16 +299,13 @@ done: static herr_t H5O_stab_free (void *mesg) { - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5O_stab_free, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_stab_free); assert (mesg); H5FL_FREE(H5O_stab_t,mesg); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } @@ -336,7 +329,7 @@ H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg) const H5O_stab_t *stab = (const H5O_stab_t *) _mesg; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_stab_delete, FAIL); + FUNC_ENTER_NOAPI_NOINIT(H5O_stab_delete); /* check args */ assert(f); @@ -371,9 +364,8 @@ H5O_stab_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE * int indent, int fwidth) { const H5O_stab_t *stab = (const H5O_stab_t *) _mesg; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_stab_debug, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_stab_debug); /* check args */ assert(f); @@ -388,6 +380,5 @@ H5O_stab_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE * HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Name heap address:", stab->heap_addr); -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 735a339..703627b 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -3798,7 +3798,7 @@ H5S_hyper_adjust_helper (H5S_hyper_span_info_t *spans, const hssize_t *offset) { H5S_hyper_span_t *span; /* Pointer to current span in span tree */ - FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_adjust_helper); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_adjust_helper); /* Sanity check */ assert(spans); @@ -3909,7 +3909,7 @@ H5S_hyper_move_helper (H5S_hyper_span_info_t *spans, const hssize_t *offset) { H5S_hyper_span_t *span; /* Pointer to current span in span tree */ - FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_move_helper); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_move_helper); /* Sanity check */ assert(spans); @@ -6814,7 +6814,7 @@ H5S_hyper_get_seq_list(const H5S_t *space, unsigned UNUSED flags, H5S_sel_iter_t { herr_t ret_value; /* return value */ - FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_get_seq_list); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_get_seq_list); /* Check args */ assert(space); diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 7433384..dfee616 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -158,7 +158,7 @@ H5T_commit (H5G_entry_t *loc, const char *name, H5T_t *type, hid_t dxpl_id) */ if (H5O_create (file, dxpl_id, 64, &(type->ent))<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create data type object header"); - if (H5O_modify (&(type->ent), H5O_DTYPE_ID, 0, H5O_FLAG_CONSTANT, 1, type, dxpl_id)<0) + if (H5O_modify (&(type->ent), H5O_DTYPE_ID, 0, H5O_FLAG_CONSTANT, H5O_UPDATE_TIME, type, dxpl_id)<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message"); if (H5G_insert (loc, name, &(type->ent), dxpl_id)<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to name data type"); diff --git a/src/H5Zszip.c b/src/H5Zszip.c index 0fa91d4..48efb81 100644 --- a/src/H5Zszip.c +++ b/src/H5Zszip.c @@ -82,7 +82,7 @@ const H5Z_class_t H5Z_SZIP[1] = {{ *------------------------------------------------------------------------- */ static herr_t -H5Z_can_apply_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) +H5Z_can_apply_szip(hid_t UNUSED dcpl_id, hid_t type_id, hid_t UNUSED space_id) { int dtype_size; /* Datatype's size (in bits) */ H5T_order_t dtype_order; /* Datatype's endianness order */ -- cgit v0.12