Commit a0e097bb authored by Tim Peters's avatar Tim Peters

BTree_findRangeEnd(): Rearranged the persistence macros to cut down a

little on redundant activations.
parent d82d25a3
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
****************************************************************************/ ****************************************************************************/
#define BTREETEMPLATE_C "$Id: BTreeTemplate.c,v 1.48 2002/06/13 04:28:06 tim_one Exp $\n" #define BTREETEMPLATE_C "$Id: BTreeTemplate.c,v 1.49 2002/06/13 04:49:01 tim_one Exp $\n"
/* /*
** _BTree_get ** _BTree_get
...@@ -967,26 +967,24 @@ BTree_findRangeEnd(BTree *self, PyObject *keyarg, int low, ...@@ -967,26 +967,24 @@ BTree_findRangeEnd(BTree *self, PyObject *keyarg, int low,
} }
/* High-end search: if it's possible to go left, do so. */ /* High-end search: if it's possible to go left, do so. */
else if (deepest_smaller) { else if (deepest_smaller) {
UNLESS(PER_USE(deepest_smaller)) goto Done;
if (deepest_smaller_is_btree) { if (deepest_smaller_is_btree) {
/* We own the reference this returns. */ UNLESS(PER_USE(deepest_smaller)) goto Done;
pbucket = BTree_lastBucket(BTREE(deepest_smaller)); /* 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 { else {
pbucket = BUCKET(deepest_smaller); pbucket = BUCKET(deepest_smaller);
Py_INCREF(pbucket); Py_INCREF(pbucket);
} }
PER_ALLOW_DEACTIVATION(deepest_smaller); UNLESS(PER_USE(pbucket)) goto Done;
PER_ACCESSED(deepest_smaller); result = 1;
if (pbucket) { *bucket = pbucket; /* transfer ownership to caller */
UNLESS(PER_USE(pbucket)) goto Done; *offset = pbucket->len - 1;
result = 1; PER_ALLOW_DEACTIVATION(pbucket);
*bucket = pbucket; /* transfer ownership to caller */ PER_ACCESSED(pbucket);
*offset = pbucket->len - 1;
PER_ALLOW_DEACTIVATION(pbucket);
PER_ACCESSED(pbucket);
}
/* pbucket NULL is an error */
} }
else else
result = 0; /* simply not found */ result = 0; /* simply not found */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment