summaryrefslogtreecommitdiffstats
path: root/src/H5HG.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-09-06 18:54:16 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-09-06 18:54:16 (GMT)
commitb0d47e55f7a9274cc18458756b4e48dd8169ea43 (patch)
tree27a42b859d1772f63881b911924201fc2987f94a /src/H5HG.c
parentbd346629483722e7bae94521a33df4ec7a58bf0b (diff)
downloadhdf5-b0d47e55f7a9274cc18458756b4e48dd8169ea43.zip
hdf5-b0d47e55f7a9274cc18458756b4e48dd8169ea43.tar.gz
hdf5-b0d47e55f7a9274cc18458756b4e48dd8169ea43.tar.bz2
[svn-r7446] Purpose:
Code cleanup/bug fix Description: Move metadata cache calls around a bit so they protect the usage of the metadata better. Platforms tested: FreeBSD 4.9 (sleipnir) too small to need h5committest
Diffstat (limited to 'src/H5HG.c')
-rw-r--r--src/H5HG.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/H5HG.c b/src/H5HG.c
index 559bc1c..4c81a93 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -786,6 +786,7 @@ H5HG_peek (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj)
}
}
}
+ heap=NULL;
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -853,6 +854,7 @@ H5HG_read (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object/*out*/)
}
}
}
+ heap = NULL;
/* Set return value */
ret_value=object;
@@ -943,6 +945,7 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj)
size_t need;
int i;
unsigned u;
+ hbool_t deleted=FALSE; /* Whether the heap gets deleted */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5HG_remove, FAIL);
@@ -995,11 +998,11 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj)
heap->cache_info.dirty = FALSE;
H5_CHECK_OVERFLOW(heap->size,size_t,hsize_t);
H5MF_xfree(f, H5FD_MEM_GHEAP, dxpl_id, heap->addr, (hsize_t)heap->size);
- H5AC_flush (f, dxpl_id, H5AC_GHEAP, heap->addr, H5F_FLUSH_INVALIDATE);
+ deleted=TRUE; /* Indicate that the object was deleted, for the unprotect call */
} else {
/*
* If the heap is in the CWFS list then advance it one position. The
- * H5AC_find() might have done that too, but that's okay. If the
+ * H5AC_protect() might have done that too, but that's okay. If the
* heap isn't on the CWFS list then add it to the end.
*/
for (i=0; i<f->shared->ncwfs; i++) {
@@ -1017,9 +1020,9 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj)
}
}
- if (H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, FALSE) != SUCCEED)
+done:
+ if (heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, deleted) != SUCCEED)
HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header");
-done:
FUNC_LEAVE_NOAPI(ret_value);
}