summaryrefslogtreecommitdiffstats
path: root/src/H5O.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-04-06 22:01:24 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-04-06 22:01:24 (GMT)
commitfa279bfcb7bb294e5e2611453e2b778f76752844 (patch)
tree8d32ddf37c5d023fb69208cf86fd503239bdf856 /src/H5O.c
parenteeb841b26bdd371f2e3ae506af6390828205691a (diff)
downloadhdf5-fa279bfcb7bb294e5e2611453e2b778f76752844.zip
hdf5-fa279bfcb7bb294e5e2611453e2b778f76752844.tar.gz
hdf5-fa279bfcb7bb294e5e2611453e2b778f76752844.tar.bz2
[svn-r18526] Description:
Bring r18525 from trunk to 1.8 branch: Bring r18523 from metadata journaling "merging" branch to trunk: Bring metadata journaling branch into closer correspondence with trunk: extract data structure freeing routines from metadata cache client 'destroy' callbacks. Tested on: FreeBSD/32 6.3 (duty) in debug mode (h5committested on trunk)
Diffstat (limited to 'src/H5O.c')
-rw-r--r--src/H5O.c66
1 files changed, 65 insertions, 1 deletions
diff --git a/src/H5O.c b/src/H5O.c
index 402e7ee..609d9ad 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1243,7 +1243,7 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, hid_t ocpl_id,
done:
if(ret_value < 0 && oh)
- if(H5O_dest(f, oh) < 0)
+ if(H5O_free(oh) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
FUNC_LEAVE_NOAPI(ret_value)
@@ -3058,3 +3058,67 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_visit() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_free
+ *
+ * Purpose: Destroys an object header.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Jan 15 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_free(H5O_t *oh)
+{
+ unsigned u; /* Local index variable */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_free)
+
+ /* check args */
+ HDassert(oh);
+
+ /* Destroy chunks */
+ if(oh->chunk) {
+ for(u = 0; u < oh->nchunks; u++) {
+ /* Verify that chunk is clean */
+ HDassert(oh->chunk[u].dirty == 0);
+
+ oh->chunk[u].image = H5FL_BLK_FREE(chunk_image, oh->chunk[u].image);
+ } /* end for */
+
+ oh->chunk = (H5O_chunk_t *)H5FL_SEQ_FREE(H5O_chunk_t, oh->chunk);
+ } /* end if */
+
+ /* Destroy messages */
+ if(oh->mesg) {
+ for(u = 0; u < oh->nmesgs; u++) {
+#ifndef NDEBUG
+ /* Verify that message is clean, unless it could have been marked
+ * dirty by decoding */
+ if(oh->ndecode_dirtied && oh->mesg[u].dirty)
+ oh->ndecode_dirtied--;
+ else
+ HDassert(oh->mesg[u].dirty == 0);
+#endif /* NDEBUG */
+
+ H5O_msg_free_mesg(&oh->mesg[u]);
+ } /* end for */
+
+ /* Make sure we accounted for all the messages dirtied by decoding */
+ HDassert(!oh->ndecode_dirtied);
+
+ oh->mesg = (H5O_mesg_t *)H5FL_SEQ_FREE(H5O_mesg_t, oh->mesg);
+ } /* end if */
+
+ /* destroy object header */
+ oh = H5FL_FREE(H5O_t, oh);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_free() */
+