summaryrefslogtreecommitdiffstats
path: root/src/H5Gstab.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-11-16 04:29:18 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-11-16 04:29:18 (GMT)
commitfb4f4a22f7053619349b30821b7f06266e54598b (patch)
tree6b1cae17789aedb051fd1858c7a10fb0e16d8cef /src/H5Gstab.c
parentab9425d057dd0a61154dc78e158707fabf45dfe2 (diff)
downloadhdf5-fb4f4a22f7053619349b30821b7f06266e54598b.zip
hdf5-fb4f4a22f7053619349b30821b7f06266e54598b.tar.gz
hdf5-fb4f4a22f7053619349b30821b7f06266e54598b.tar.bz2
[svn-r12922] Description:
Add support for "delete by index" to "old-style" groups, finishing implmentation of H5Ldelete_by_idx() routine. Tested on: FreeBSD/32 4.11 (sleipnir) Linux/32 2.4 (heping) Linux/64 2.4 (mir) Aix/32 5.? (copper)
Diffstat (limited to 'src/H5Gstab.c')
-rw-r--r--src/H5Gstab.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index ec813d8..f87294b 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -325,6 +325,60 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5G_stab_remove_by_idx
+ *
+ * Purpose: Remove NAME from a symbol table, according to the name index.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, November 15, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_stab_remove_by_idx(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r,
+ H5_iter_order_t order, hsize_t n)
+{
+ H5O_stab_t stab; /* Symbol table message */
+ H5G_bt_ud2_t udata; /* Data to pass through B-tree */
+ H5O_link_t obj_lnk; /* Object's link within group */
+ hbool_t lnk_copied = FALSE; /* Whether the link was copied */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_stab_remove_by_idx, FAIL)
+
+ HDassert(grp_oloc && grp_oloc->file);
+
+ /* Look up name of link to remove, by index */
+ if(H5G_stab_lookup_by_idx(grp_oloc, order, n, &obj_lnk, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get link information")
+ lnk_copied = TRUE;
+
+ /* Read in symbol table message */
+ if(NULL == H5O_read(grp_oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
+ HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table")
+
+ /* Initialize data to pass through B-tree */
+ udata.common.name = obj_lnk.name;
+ udata.common.heap_addr = stab.heap_addr;
+ udata.adj_link = TRUE;
+ udata.grp_full_path_r = grp_full_path_r;
+
+ /* Remove link from symbol table */
+ if(H5B_remove(grp_oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr, &udata) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to remove entry")
+
+done:
+ /* Reset the link information, if we have a copy */
+ if(lnk_copied)
+ H5O_reset(H5O_LINK_ID, &obj_lnk);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5G_stab_remove() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5G_stab_delete
*
* Purpose: Delete entire symbol table information from file