summaryrefslogtreecommitdiffstats
path: root/src/H5B.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-06-08 15:25:58 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-06-08 15:25:58 (GMT)
commit67a1ff05db79ca0e7cd44de85997b128a158e229 (patch)
tree7b4bcc59e856569cc45c9292067ef7365abee91b /src/H5B.c
parent8957d31809ef6637e2b1ea62f76160da0a24e936 (diff)
downloadhdf5-67a1ff05db79ca0e7cd44de85997b128a158e229.zip
hdf5-67a1ff05db79ca0e7cd44de85997b128a158e229.tar.gz
hdf5-67a1ff05db79ca0e7cd44de85997b128a158e229.tar.bz2
[svn-r8625] Purpose:
Code optimization Description: Avoid pushing errors on error stack when an object is not found in a B-tree. Sometimes we are just checking if the object exists before we insert it into the B-tree and the higher levels in the library should be responsible for determining if not finding the object in B-tree is really an error. Platforms tested: Solaris 2.7 (arabica) FreeBSD 4.10 (sleipnir) w/parallel too minor to require h5committest
Diffstat (limited to 'src/H5B.c')
-rw-r--r--src/H5B.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/H5B.c b/src/H5B.c
index bb5388e..dff894d 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -624,10 +624,10 @@ H5B_clear(H5F_t *f, H5B_t *bt, hbool_t destroy)
if (destroy)
if (H5B_dest(f, bt) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node");
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_clear() */
@@ -659,7 +659,7 @@ H5B_size(H5F_t *f, H5B_t *bt)
assert(bt->type);
ret_value = H5B_nodesize(f, bt->type, NULL, bt->sizeof_rkey);
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -733,7 +733,15 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u
}
}
if (cmp)
+ /* Note: don't push error on stack, leave that to next higher level,
+ * since many times the B-tree is searched in order to determine
+ * if an object exists in the B-tree or not. -QAK
+ */
+#ifdef OLD_WAY
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree key not found")
+#else /* OLD_WAY */
+ HGOTO_DONE(FAIL)
+#endif /* OLD_WAY */
/*
* Follow the link to the subtree or to the data node.
@@ -753,10 +761,26 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u
if (level > 0) {
if (H5B_find(f, dxpl_id, type, child, udata) < 0)
+ /* Note: don't push error on stack, leave that to next higher level,
+ * since many times the B-tree is searched in order to determine
+ * if an object exists in the B-tree or not. -QAK
+ */
+#ifdef OLD_WAY
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "key not found in subtree")
+#else /* OLD_WAY */
+ HGOTO_DONE(FAIL)
+#endif /* OLD_WAY */
} else {
if ((type->found) (f, dxpl_id, child, nkey1, udata, nkey2) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "key not found in leaf node")
+ /* Note: don't push error on stack, leave that to next higher level,
+ * since many times the B-tree is searched in order to determine
+ * if an object exists in the B-tree or not. -QAK
+ */
+#ifdef OLD_WAY
+ HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "key not found in leaf node")
+#else /* OLD_WAY */
+ HGOTO_DONE(FAIL)
+#endif /* OLD_WAY */
}
done: