[Zope-Checkins] CVS: Releases/Zope/lib/python/BTrees - BTreeTemplate.c:1.19
Matthew T. Kromer
matt@zope.com
Wed, 12 Sep 2001 16:47:17 -0400
Update of /cvs-repository/Releases/Zope/lib/python/BTrees
In directory cvs.zope.org:/tmp/cvs-serv20695
Modified Files:
BTreeTemplate.c
Log Message:
Patch BTree_findRangeEnd to check the next bucket on a miss on the current
bucket when doing a "low" search.
=== Releases/Zope/lib/python/BTrees/BTreeTemplate.c 1.18 => 1.19 ===
else
{
- *bucket = BUCKET(self->data[min].value);
- if ((i=Bucket_findRangeEnd(*bucket, keyarg, low, offset)))
- Py_INCREF(*bucket);
+ i = 0;
+ /* Because we might miss on a range search where max=len */
+ while(i == 0) {
+ *bucket = BUCKET(self->data[min].value);
+ i=Bucket_findRangeEnd(*bucket, keyarg, low, offset);
+ if (i)
+ {
+ Py_INCREF(*bucket);
+ break;
+ }
+ /* if we missed, on low search, go to next bucket */
+ else if (low && i == 0 && min+1 < self->len) min++;
+ else break;
+ }
}
return i;