[Zodb-checkins] CVS: Zope/lib/python/BTrees - BTreeTemplate.c:1.49
Tim Peters
tim.one@comcast.net
Thu, 13 Jun 2002 00:49:02 -0400
Update of /cvs-repository/Zope/lib/python/BTrees
In directory cvs.zope.org:/tmp/cvs-serv8556
Modified Files:
BTreeTemplate.c
Log Message:
BTree_findRangeEnd(): Rearranged the persistence macros to cut down a
little on redundant activations.
=== Zope/lib/python/BTrees/BTreeTemplate.c 1.48 => 1.49 ===
/* High-end search: if it's possible to go left, do so. */
else if (deepest_smaller) {
- UNLESS(PER_USE(deepest_smaller)) goto Done;
if (deepest_smaller_is_btree) {
- /* We own the reference this returns. */
- pbucket = BTree_lastBucket(BTREE(deepest_smaller));
+ UNLESS(PER_USE(deepest_smaller)) goto Done;
+ /* We own the reference this returns. */
+ pbucket = BTree_lastBucket(BTREE(deepest_smaller));
+ PER_ALLOW_DEACTIVATION(deepest_smaller);
+ PER_ACCESSED(deepest_smaller);
+ if (pbucket == NULL) goto Done; /* error */
}
else {
- pbucket = BUCKET(deepest_smaller);
- Py_INCREF(pbucket);
+ pbucket = BUCKET(deepest_smaller);
+ Py_INCREF(pbucket);
}
- PER_ALLOW_DEACTIVATION(deepest_smaller);
- PER_ACCESSED(deepest_smaller);
- if (pbucket) {
- UNLESS(PER_USE(pbucket)) goto Done;
- result = 1;
- *bucket = pbucket; /* transfer ownership to caller */
- *offset = pbucket->len - 1;
- PER_ALLOW_DEACTIVATION(pbucket);
- PER_ACCESSED(pbucket);
- }
- /* pbucket NULL is an error */
+ UNLESS(PER_USE(pbucket)) goto Done;
+ result = 1;
+ *bucket = pbucket; /* transfer ownership to caller */
+ *offset = pbucket->len - 1;
+ PER_ALLOW_DEACTIVATION(pbucket);
+ PER_ACCESSED(pbucket);
}
else
result = 0; /* simply not found */