summaryrefslogtreecommitdiffstats
path: root/src/H5Gnode.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-09-25 22:18:33 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-09-25 22:18:33 (GMT)
commit68c01f91d94d1fa7a7cff198cb8daf6c89f05da7 (patch)
tree8035fe4ed2f2a10855575c91969e4107af382d46 /src/H5Gnode.c
parent02296972ec8a90ad50d89786755d0e953e95b455 (diff)
downloadhdf5-68c01f91d94d1fa7a7cff198cb8daf6c89f05da7.zip
hdf5-68c01f91d94d1fa7a7cff198cb8daf6c89f05da7.tar.gz
hdf5-68c01f91d94d1fa7a7cff198cb8daf6c89f05da7.tar.bz2
[svn-r14154] Description:
Finish deprecating last H5G symbol (H5G_obj_t) - yay! Lots of misc. library fixes to remove confusion between links and objects. The tools could still use another pass, to remove h5trav_type_t type and make the correct distinction between links & objects. Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode AIX/32 5.3 (copper) w/FORTRAN, w/parallel, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode
Diffstat (limited to 'src/H5Gnode.c')
-rw-r--r--src/H5Gnode.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index eaa426f..6cff5a0 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -1216,11 +1216,9 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
/* "Normal" removal of a single entry from the symbol table node */
if(udata->common.name != NULL) {
- H5L_type_t lnk_type; /* Type of link being removed */
- haddr_t lnk_addr; /* Address of object (for hard link) */
+ H5O_link_t lnk; /* Constructed link for replacement */
size_t len; /* Length of string in local heap */
const char *base; /* Base of heap */
- const char *s; /* Pointer to string in local heap */
/* Get base address of heap */
base = H5HL_offset_into(f, udata->common.heap, (size_t)0);
@@ -1228,6 +1226,8 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
/* Find the name with a binary search */
rt = sn->nsyms;
while(lt < rt && cmp) {
+ const char *s; /* Pointer to string in local heap */
+
idx = (lt + rt) / 2;
s = base + sn->entry[idx].name_off;
cmp = HDstrcmp(udata->common.name, s);
@@ -1240,48 +1240,50 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
if(cmp)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "name not found")
+ /* Get a pointer to the name of the link */
+ if(NULL == (lnk.name = H5HL_offset_into(f, udata->common.heap, sn->entry[idx].name_off)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link name")
+
+ /* Set up rest of link structure */
+ lnk.corder_valid = FALSE;
+ lnk.corder = 0;
+ lnk.cset = H5T_CSET_ASCII;
if(sn->entry[idx].type == H5G_CACHED_SLINK) {
- /* Set the type of the link removed */
- lnk_type = H5L_TYPE_SOFT;
- lnk_addr = HADDR_UNDEF;
-
- /* Remove the soft link's value from the local heap */
- s = H5HL_offset_into(f, udata->common.heap, sn->entry[idx].cache.slink.lval_offset);
- if(s) {
- len = HDstrlen(s) + 1;
- if(H5HL_remove(f, dxpl_id, udata->common.heap, sn->entry[idx].cache.slink.lval_offset, len) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, H5B_INS_ERROR, "unable to remove soft link from local heap")
- } /* end if */
+ lnk.type = H5L_TYPE_SOFT;
+ lnk.u.soft.name = H5HL_offset_into(f, udata->common.heap, sn->entry[idx].cache.slink.lval_offset);
} /* end if */
else {
- /* Set the link information */
- lnk_type = H5L_TYPE_HARD;
+ lnk.type = H5L_TYPE_HARD;
HDassert(H5F_addr_defined(sn->entry[idx].header));
- lnk_addr = sn->entry[idx].header;
+ lnk.u.hard.addr = sn->entry[idx].header;
} /* end else */
- /* Get a pointer to the name of the link */
- if(NULL == (s = H5HL_offset_into(f, udata->common.heap, sn->entry[idx].name_off)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link name")
-
- /* Get the object's type */
- if(H5G_link_name_replace(f, dxpl_id, udata->grp_full_path_r, s, lnk_type, lnk_addr) < 0)
+ /* Replace any object names */
+ if(H5G_link_name_replace(f, dxpl_id, udata->grp_full_path_r, &lnk) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object type")
/* Decrement the ref. count for hard links */
- if(lnk_type == H5L_TYPE_HARD) {
+ if(lnk.type == H5L_TYPE_HARD) {
H5O_loc_t tmp_oloc; /* Temporary object location */
/* Build temporary object location */
tmp_oloc.file = f;
- tmp_oloc.addr = lnk_addr;
+ tmp_oloc.addr = lnk.u.hard.addr;
if(H5O_link(&tmp_oloc, -1, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to decrement object link count")
} /* end if */
+ else {
+ /* Remove the soft link's value from the local heap */
+ if(lnk.u.soft.name) {
+ len = HDstrlen(lnk.u.soft.name) + 1;
+ if(H5HL_remove(f, dxpl_id, udata->common.heap, sn->entry[idx].cache.slink.lval_offset, len) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, H5B_INS_ERROR, "unable to remove soft link from local heap")
+ } /* end if */
+ } /* end else */
/* Remove the link's name from the local heap */
- len = HDstrlen(s) + 1;
+ len = HDstrlen(lnk.name) + 1;
if(H5HL_remove(f, dxpl_id, udata->common.heap, sn->entry[idx].name_off, len) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, H5B_INS_ERROR, "unable to remove link name from local heap")