[Zodb-checkins] CVS: Zope/lib/python/BTrees - SetOpTemplate.c:1.20
Tim Peters
tim.one@comcast.net
Wed, 5 Jun 2002 12:03:12 -0400
Update of /cvs-repository/Zope/lib/python/BTrees
In directory cvs.zope.org:/tmp/cvs-serv6524
Modified Files:
SetOpTemplate.c
Log Message:
multiunion(): Not entirely sure, but I believe this function has to do
a persistence dance on the buckets/sets it handles directly by itself.
If so, a similar but different change is also needed on the Zope3 branch.
=== Zope/lib/python/BTrees/SetOpTemplate.c 1.19 => 1.20 ===
if (set->ob_type == (PyTypeObject*)&SetType ||
set->ob_type == (PyTypeObject*)&BucketType) {
+ int setsize;
+ int size_desired;
- const int setsize = SIZED(set)->len;
- int size_desired = result->len + setsize;
+ UNLESS (PER_USE(set)) goto Error;
+ setsize = SIZED(set)->len;
+ size_desired = result->len + setsize;
/* If there are more to come, overallocate by 25% (arbitrary). */
if (i < n-1)
size_desired += size_desired >> 2;
if (size_desired && size_desired > result->size) {
- if (Bucket_grow(result, size_desired, 1) < 0)
+ if (Bucket_grow(result, size_desired, 1) < 0) {
+ PER_ALLOW_DEACTIVATION(set);
+ PER_ACCESSED(set);
goto Error;
+ }
}
memcpy(result->keys + result->len,
BUCKET(set)->keys,
setsize * sizeof(KEY_TYPE));
result->len += setsize;
+ PER_ALLOW_DEACTIVATION(set);
+ PER_ACCESSED(set);
}
else {
/* No cheap way: iterate over set's elements one at a time. */