[Zodb-checkins] CVS: ZODB3/BTrees - BTreeItemsTemplate.c:1.19.16.2
BTreeModuleTemplate.c:1.37.92.5 BTreeTemplate.c:1.74.10.3
SetTemplate.c:1.16.52.3 TreeSetTemplate.c:1.15.52.3
Tim Peters
tim.one at comcast.net
Mon Jul 7 16:56:13 EDT 2003
Update of /cvs-repository/ZODB3/BTrees
In directory cvs.zope.org:/tmp/cvs-serv8486/BTrees
Modified Files:
Tag: zodb33-devel-branch
BTreeItemsTemplate.c BTreeModuleTemplate.c BTreeTemplate.c
SetTemplate.c TreeSetTemplate.c
Log Message:
Use the ZODB3 persistence macros more consistently.
=== ZODB3/BTrees/BTreeItemsTemplate.c 1.19.16.1 => 1.19.16.2 ===
--- ZODB3/BTrees/BTreeItemsTemplate.c:1.19.16.1 Thu Jul 3 17:38:59 2003
+++ ZODB3/BTrees/BTreeItemsTemplate.c Mon Jul 7 15:56:03 2003
@@ -100,14 +100,12 @@
break; /* we already counted the last bucket */
Py_INCREF(next);
- PER_ALLOW_DEACTIVATION(b);
- PyPersist_SetATime(b);
+ PER_UNUSE(b);
Py_DECREF(b);
b = next;
PER_USE_OR_RETURN(b, -1);
}
- PER_ALLOW_DEACTIVATION(b);
- PyPersist_SetATime(b);
+ PER_UNUSE(b);
Py_DECREF(b);
return r >= 0 ? r : 0;
@@ -168,8 +166,7 @@
PER_USE_OR_RETURN(currentbucket, -1);
max = currentbucket->len - currentoffset - 1;
b = currentbucket->next;
- PER_ALLOW_DEACTIVATION(currentbucket);
- PER_ACCESSED(currentbucket);
+ PER_UNUSE(currentbucket);
if (delta <= max) {
currentoffset += delta;
pseudoindex += delta;
@@ -207,8 +204,7 @@
delta += currentoffset + 1;
PER_USE_OR_RETURN(currentbucket, -1);
currentoffset = currentbucket->len - 1;
- PER_ALLOW_DEACTIVATION(currentbucket);
- PER_ACCESSED(currentbucket);
+ PER_UNUSE(currentbucket);
}
assert(pseudoindex == i);
@@ -219,8 +215,7 @@
*/
PER_USE_OR_RETURN(currentbucket, -1);
error = currentoffset < 0 || currentoffset >= currentbucket->len;
- PER_ALLOW_DEACTIVATION(currentbucket);
- PER_ACCESSED(currentbucket);
+ PER_UNUSE(currentbucket);
if (error) {
PyErr_SetString(PyExc_RuntimeError,
"the bucket being iterated changed size");
=== ZODB3/BTrees/BTreeModuleTemplate.c 1.37.92.4 => 1.37.92.5 ===
--- ZODB3/BTrees/BTreeModuleTemplate.c:1.37.92.4 Thu Jul 3 18:11:56 2003
+++ ZODB3/BTrees/BTreeModuleTemplate.c Mon Jul 7 15:56:03 2003
@@ -28,9 +28,6 @@
#define PER_ACCESSED(O) 1
#endif
-/* XXX Go back to using PER_USE everywhere. */
-#define PyPersist_SetATime PER_USE
-
/* So sue me. This pair gets used all over the place, so much so that it
* interferes with understanding non-persistence parts of algorithms.
* PER_UNUSE can be used after a successul PER_USE or PER_USE_OR_RETURN.
@@ -286,8 +283,7 @@
trailing = first;
PER_USE_OR_RETURN(first, -1);
first = first->next;
- PER_ALLOW_DEACTIVATION(trailing);
- PER_ACCESSED(trailing);
+ PER_UNUSE(trailing);
if (first == *current) {
*current = trailing;
=== ZODB3/BTrees/BTreeTemplate.c 1.74.10.2 => 1.74.10.3 ===
--- ZODB3/BTrees/BTreeTemplate.c:1.74.10.2 Thu Jul 3 17:38:59 2003
+++ ZODB3/BTrees/BTreeTemplate.c Mon Jul 7 15:56:03 2003
@@ -478,8 +478,7 @@
self = BTREE(pchild);
PER_USE_OR_RETURN(self, NULL);
result = BTree_lastBucket(self);
- PER_ALLOW_DEACTIVATION(self);
- PER_ACCESSED(self);
+ PER_UNUSE(self);
}
else {
Py_INCREF(pchild);
@@ -1274,8 +1273,7 @@
if (pchild_is_btree) {
if (self_got_rebound) {
- PER_ALLOW_DEACTIVATION(self);
- PER_ACCESSED(self);
+ PER_UNUSE(self);
}
self = BTREE(pchild);
self_got_rebound = 1;
@@ -1311,8 +1309,7 @@
}
else
result = 0;
- PER_ALLOW_DEACTIVATION(pbucket);
- PER_ACCESSED(pbucket);
+ PER_UNUSE(pbucket);
}
/* High-end search: if it's possible to go left, do so. */
else if (deepest_smaller) {
@@ -1320,8 +1317,7 @@
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);
+ PER_UNUSE(deepest_smaller);
if (pbucket == NULL) goto Done; /* error */
}
else {
@@ -1332,16 +1328,14 @@
result = 1;
*bucket = pbucket; /* transfer ownership to caller */
*offset = pbucket->len - 1;
- PER_ALLOW_DEACTIVATION(pbucket);
- PER_ACCESSED(pbucket);
+ PER_UNUSE(pbucket);
}
else
result = 0; /* simply not found */
Done:
if (self_got_rebound) {
- PER_ALLOW_DEACTIVATION(self);
- PER_ACCESSED(self);
+ PER_UNUSE(self);
}
return result;
}
@@ -1378,8 +1372,7 @@
else if (min)
{
bucket = self->firstbucket;
- PER_ALLOW_DEACTIVATION(self);
- PER_ACCESSED(self);
+ PER_UNUSE(self);
PER_USE_OR_RETURN(bucket, NULL);
Py_INCREF(bucket);
offset = 0;
=== ZODB3/BTrees/SetTemplate.c 1.16.52.2 => 1.16.52.3 ===
--- ZODB3/BTrees/SetTemplate.c:1.16.52.2 Thu Jul 3 17:39:00 2003
+++ ZODB3/BTrees/SetTemplate.c Mon Jul 7 15:56:03 2003
@@ -157,8 +157,7 @@
PER_PREVENT_DEACTIVATION(self);
r=_set_setstate(self, args);
- PER_ALLOW_DEACTIVATION(self);
- PyPersist_SetATime(self);
+ PER_UNUSE(self);
if (r < 0) return NULL;
Py_INCREF(Py_None);
@@ -251,8 +250,7 @@
PER_USE_OR_RETURN(self, -1);
r = self->len;
- PER_ALLOW_DEACTIVATION(self);
- PyPersist_SetATime(self);
+ PER_UNUSE(self);
return r;
}
@@ -270,8 +268,7 @@
else
IndexError(index);
- PER_ALLOW_DEACTIVATION(self);
- PyPersist_SetATime(self);
+ PER_UNUSE(self);
return r;
}
@@ -354,7 +351,7 @@
else
{
i->position = -1;
- PyPersist_SetATime(BUCKET(i->set));
+ PER_ACCESSED(BUCKET(i->set));
}
PER_ALLOW_DEACTIVATION(BUCKET(i->set));
=== ZODB3/BTrees/TreeSetTemplate.c 1.15.52.2 => 1.15.52.3 ===
--- ZODB3/BTrees/TreeSetTemplate.c:1.15.52.2 Thu Jul 3 17:39:00 2003
+++ ZODB3/BTrees/TreeSetTemplate.c Mon Jul 7 15:56:03 2003
@@ -109,8 +109,7 @@
PER_PREVENT_DEACTIVATION(self);
r=_BTree_setstate(self, args, 1);
- PER_ALLOW_DEACTIVATION(self);
- PyPersist_SetATime(self);
+ PER_UNUSE(self);
if (r < 0) return NULL;
Py_INCREF(Py_None);
More information about the Zodb-checkins
mailing list