summaryrefslogtreecommitdiffstats
path: root/src/H5Gnode.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-08-29 05:36:16 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-08-29 05:36:16 (GMT)
commite1747e456cf5605faeaab199cfbb3e72dca6cd40 (patch)
tree250395108e569cbcea9e749ab73ee90dd58b0234 /src/H5Gnode.c
parentfefbe61aca1a42e716e900be7af5b382be5e19c1 (diff)
downloadhdf5-e1747e456cf5605faeaab199cfbb3e72dca6cd40.zip
hdf5-e1747e456cf5605faeaab199cfbb3e72dca6cd40.tar.gz
hdf5-e1747e456cf5605faeaab199cfbb3e72dca6cd40.tar.bz2
[svn-r11307] Purpose:
Code cleanup Description: Clean up internals of group creation & iteration code. Platforms tested: FreeBSD 4.11 (sleipnir) Mac OS X (nile) Too minor to require h5committest
Diffstat (limited to 'src/H5Gnode.c')
-rw-r--r--src/H5Gnode.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 214e3fe..7aac30a 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -996,18 +996,17 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key
if (cmp)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found");
- if (bt_udata->operation==H5G_OPER_FIND)
- /*
- * The caller is querying the symbol entry, copy it into the UDATA
- * entry field. (Hmm... should this use H5G_ent_copy()? - QAK)
- */
- bt_udata->ent = sn->entry[idx];
- else
- HGOTO_ERROR(H5E_SYM, H5E_UNSUPPORTED, FAIL, "internal erorr (unknown symbol find operation)");
+ /*
+ * The caller is querying the symbol entry, copy it into the UDATA
+ * entry field.
+ *
+ * (do a NULL copy, since the entry's name will be constructed later)
+ */
+ if (H5G_ent_copy(bt_udata->ent, &sn->entry[idx], H5G_COPY_NULL)<0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to copy entry");
done:
- if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn,
- H5AC__NO_FLAGS_SET) < 0)
+ if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1137,7 +1136,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key,
*/
offset = H5HL_insert(f, dxpl_id, bt_udata->heap_addr, HDstrlen(bt_udata->name)+1,
bt_udata->name);
- bt_udata->ent.name_off = offset;
+ bt_udata->ent->name_off = offset;
if (0==offset || (size_t)(-1)==offset)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5B_INS_ERROR, "unable to insert symbol name into heap");
if ((size_t)(sn->nsyms) >= 2*H5F_SYM_LEAF_K(f)) {
@@ -1194,12 +1193,19 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key,
}
}
- /* Move entries */
+ /* Move entries down to make room for new entry */
HDmemmove(insert_into->entry + idx + 1,
insert_into->entry + idx,
(insert_into->nsyms - idx) * sizeof(H5G_entry_t));
- H5G_ent_copy(&(insert_into->entry[idx]), &(bt_udata->ent),H5G_COPY_NULL);
+
+ /* Copy new entry into table */
+ /* (use H5G_COPY_NULL because we don't track the object names in the table) */
+ H5G_ent_copy(&(insert_into->entry[idx]), bt_udata->ent, H5G_COPY_NULL);
+
+ /* Flag entry as dirty */
insert_into->entry[idx].dirty = TRUE;
+
+ /* Increment # of symbols in table */
insert_into->nsyms += 1;
done:
@@ -1844,7 +1850,7 @@ H5G_node_close(const H5F_t *f)
/* Free the raw B-tree node buffer */
if (H5F_GRP_BTREE_SHARED(f))
- H5RC_DEC(H5F_GRP_BTREE_SHARED(f));
+ H5RC_DEC(H5F_GRP_BTREE_SHARED(f));
FUNC_LEAVE_NOAPI(SUCCEED);
} /* end H5G_node_close */