summaryrefslogtreecommitdiffstats
path: root/src/H5Olink.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-02-05 22:26:44 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-02-05 22:26:44 (GMT)
commitc560e68258bef4235fac0cebfe65e8850e25b61d (patch)
tree2ea489afcde3124fcb648161b41bd4101618e9df /src/H5Olink.c
parent51875fc8881cdfa0c939fba82b7a00012a2c611e (diff)
downloadhdf5-c560e68258bef4235fac0cebfe65e8850e25b61d.zip
hdf5-c560e68258bef4235fac0cebfe65e8850e25b61d.tar.gz
hdf5-c560e68258bef4235fac0cebfe65e8850e25b61d.tar.bz2
[svn-r13240] Description:
More cleanups on the object header message handling code, to make it easier to work with and move forward on the creation order coding. Various other minor cleanups & warning fixes. Tested on: FreeBSD/32 6.2 (duty)
Diffstat (limited to 'src/H5Olink.c')
-rw-r--r--src/H5Olink.c79
1 files changed, 38 insertions, 41 deletions
diff --git a/src/H5Olink.c b/src/H5Olink.c
index 47ebfdb..628ce56 100644
--- a/src/H5Olink.c
+++ b/src/H5Olink.c
@@ -43,7 +43,6 @@ static void *H5O_link_copy(const void *_mesg, void *_dest);
static size_t H5O_link_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
static herr_t H5O_link_reset(void *_mesg);
static herr_t H5O_link_free(void *_mesg);
-/* static herr_t H5O_link_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link); */
static herr_t H5O_link_pre_copy_file(H5F_t *file_src, const void *mesg_src,
hbool_t *deleted, const H5O_copy_t *cpy_info, void *udata);
static void *H5O_link_copy_file(H5F_t *file_src, void *native_src,
@@ -494,7 +493,7 @@ H5O_link_free(void *_mesg)
*-------------------------------------------------------------------------
*/
herr_t
-H5O_link_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link)
+H5O_link_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg)
{
const H5O_link_t *lnk = (const H5O_link_t *)_mesg;
herr_t ret_value = SUCCEED; /* Return value */
@@ -506,47 +505,45 @@ H5O_link_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link)
HDassert(lnk);
/* Check for adjusting the link count when the link is removed */
- if(adj_link) {
- /* Adjust the reference count of the object when a hard link is removed */
- if(lnk->type == H5L_TYPE_HARD) {
- H5O_loc_t oloc;
-
- /* Construct object location for object, in order to decrement it's ref count */
- H5O_loc_reset(&oloc);
- oloc.file = f;
- HDassert(H5F_addr_defined(lnk->u.hard.addr));
- oloc.addr = lnk->u.hard.addr;
-
- /* Decrement the ref count for the object */
- if(H5O_link(&oloc, -1, dxpl_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to decrement object link count")
- } /* end if */
- /* Perform the "delete" callback when a user-defined link is removed */
- else if(lnk->type >= H5L_TYPE_UD_MIN) {
- const H5L_class_t *link_class; /* User-defined link class */
-
- /* Get the link class for this type of link. */
- if(NULL == (link_class = H5L_find_class(lnk->type)))
- HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "link class not registered")
-
- /* Check for delete callback */
- if(link_class->del_func) {
- hid_t file_id; /* ID for the file the link is located in (passed to user callback) */
-
- /* Get a file ID for the file the link is in */
- if((file_id = H5F_get_id(f)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get file ID")
-
- /* Call user-defined link's 'delete' callback */
- if((link_class->del_func)(lnk->name, file_id, lnk->u.ud.udata, lnk->u.ud.size) < 0) {
- H5I_dec_ref(file_id);
- HGOTO_ERROR(H5E_OHDR, H5E_CALLBACK, FAIL, "link deletion callback returned failure")
- } /* end if */
+ /* Adjust the reference count of the object when a hard link is removed */
+ if(lnk->type == H5L_TYPE_HARD) {
+ H5O_loc_t oloc;
+
+ /* Construct object location for object, in order to decrement it's ref count */
+ H5O_loc_reset(&oloc);
+ oloc.file = f;
+ HDassert(H5F_addr_defined(lnk->u.hard.addr));
+ oloc.addr = lnk->u.hard.addr;
+
+ /* Decrement the ref count for the object */
+ if(H5O_link(&oloc, -1, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to decrement object link count")
+ } /* end if */
+ /* Perform the "delete" callback when a user-defined link is removed */
+ else if(lnk->type >= H5L_TYPE_UD_MIN) {
+ const H5L_class_t *link_class; /* User-defined link class */
- /* Release the file ID */
- if(H5I_dec_ref(file_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file")
+ /* Get the link class for this type of link. */
+ if(NULL == (link_class = H5L_find_class(lnk->type)))
+ HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "link class not registered")
+
+ /* Check for delete callback */
+ if(link_class->del_func) {
+ hid_t file_id; /* ID for the file the link is located in (passed to user callback) */
+
+ /* Get a file ID for the file the link is in */
+ if((file_id = H5F_get_id(f)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get file ID")
+
+ /* Call user-defined link's 'delete' callback */
+ if((link_class->del_func)(lnk->name, file_id, lnk->u.ud.udata, lnk->u.ud.size) < 0) {
+ H5I_dec_ref(file_id);
+ HGOTO_ERROR(H5E_OHDR, H5E_CALLBACK, FAIL, "link deletion callback returned failure")
} /* end if */
+
+ /* Release the file ID */
+ if(H5I_dec_ref(file_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file")
} /* end if */
} /* end if */