summaryrefslogtreecommitdiffstats
path: root/src/H5Gstab.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-09-25 14:50:49 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-09-25 14:50:49 (GMT)
commit12e30dc9b284cae8dd821ffec93c344b7fb0d96b (patch)
treeca1e34bd719276349c4f75a7c38d79d361ce2025 /src/H5Gstab.c
parentf9c3920d286b9d18156d1b7d85f14852345b5e74 (diff)
downloadhdf5-12e30dc9b284cae8dd821ffec93c344b7fb0d96b.zip
hdf5-12e30dc9b284cae8dd821ffec93c344b7fb0d96b.tar.gz
hdf5-12e30dc9b284cae8dd821ffec93c344b7fb0d96b.tar.bz2
[svn-r5947] Purpose:
Code cleanup Description: Clean up ID->name code: - Reformat to better match library coding standard - Changed several algorithms to be more efficient - Integrated into library more smoothly Platforms tested: eirene w/FORTRAN & C++ arabica w/FORTRAN modi4 w/FORTRAN & parallel sleipnir
Diffstat (limited to 'src/H5Gstab.c')
-rw-r--r--src/H5Gstab.c58
1 files changed, 22 insertions, 36 deletions
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index 3f53464..bc7c949 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -121,9 +121,9 @@ done:
*
* Modifications:
*
- * Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
- * Added `id to name' support.
- * Added a deep copy of the symbol table entry
+ * Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
+ * Added `id to name' support.
+ * Added a deep copy of the symbol table entry
*
*-------------------------------------------------------------------------
*/
@@ -135,8 +135,6 @@ H5G_stab_find(H5G_entry_t *grp_ent, const char *name,
H5O_stab_t stab; /*symbol table message */
herr_t ret_value=SUCCEED; /* Return value */
- obj_ent->name=NULL;
-
FUNC_ENTER_NOAPI(H5G_stab_find, FAIL);
/* Check arguments */
@@ -153,27 +151,20 @@ H5G_stab_find(H5G_entry_t *grp_ent, const char *name,
/* search the B-tree */
if (H5B_find(grp_ent->file, H5B_SNODE, stab.btree_addr, &udata) < 0) {
- HRETURN_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found");
- }
-
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found");
+ } /* end if */
/* change OBJ_ENT only if found */
- else
- {
- if (obj_ent) {
-
- /* do a deep copy */
- if (H5G_ent_copy( &(udata.ent), obj_ent )<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to copy entry");
-
- /* insert the name into the symbol entry OBJ_ENT */
- if (H5G_insert_name( grp_ent, obj_ent, name ) < 0) {
- HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL,
- "cannot insert name");
- }
-
- }
- }
-
+ else {
+ if (obj_ent) {
+ /* do a deep copy */
+ if (H5G_ent_copy( &(udata.ent), obj_ent )<0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to copy entry");
+
+ /* insert the name into the symbol entry OBJ_ENT */
+ if (H5G_insert_name( grp_ent, obj_ent, name ) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot insert name");
+ } /* end if */
+ } /* end else */
done:
FUNC_LEAVE(ret_value);
@@ -197,8 +188,8 @@ done:
*
* Modifications:
*
- * Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
- * Added `id to name' support.
+ * Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
+ * Added `id to name' support.
*
*-------------------------------------------------------------------------
*/
@@ -225,10 +216,7 @@ H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent)
udata.operation = H5G_OPER_INSERT;
udata.name = name;
udata.heap_addr = stab.heap_addr;
-
- /* Deep copy */
- H5G_ent_copy(obj_ent, &udata.ent);
-
+ udata.ent = *obj_ent; /* Shallow copy here, deep copy happens in H5G_node_insert() callback() */
/* insert */
if (H5B_insert(grp_ent->file, H5B_SNODE, stab.btree_addr, split_ratios, &udata) < 0)
@@ -237,11 +225,9 @@ H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent)
/* update the name offset in the entry */
obj_ent->name_off = udata.ent.name_off;
- /* insert the name into the symbol entry OBJ_ENT */
- if (H5G_insert_name( grp_ent, obj_ent, name ) < 0) {
- HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL,
- "cannot insert name");
- }
+ /* insert the name into the symbol entry OBJ_ENT */
+ if(H5G_insert_name(grp_ent, obj_ent, name) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot insert name");
done:
FUNC_LEAVE(ret_value);