[Zodb-checkins] CVS: Zope3/lib/python/Persistence/BTrees - BTreeItemsTemplate.c:1.1.2.4 BTreeModuleTemplate.c:1.1.2.10 BTreeTemplate.c:1.1.2.9 BucketTemplate.c:1.1.2.9 SetOpTemplate.c:1.1.2.2 SetTemplate.c:1.1.2.8 TreeSetTemplate.c:1.1.2.6
Jeremy Hylton
jeremy@zope.com
Tue, 4 Jun 2002 14:14:48 -0400
Update of /cvs-repository/Zope3/lib/python/Persistence/BTrees
In directory cvs.zope.org:/tmp/cvs-serv16246/BTrees
Modified Files:
Tag: Zope-3x-branch
BTreeItemsTemplate.c BTreeModuleTemplate.c BTreeTemplate.c
BucketTemplate.c SetOpTemplate.c SetTemplate.c
TreeSetTemplate.c
Log Message:
Update to use PyPersist_BASE_TYPE instead of PyPersist_TYPE,
and PyPersist_SetATime() instead of PER_ACCESSED().
=== Zope3/lib/python/Persistence/BTrees/BTreeItemsTemplate.c 1.1.2.3 => 1.1.2.4 ===
Py_INCREF(next);
PER_ALLOW_DEACTIVATION(b);
- PER_ACCESSED(b);
+ PyPersist_SetATime(b);
Py_DECREF(b);
b = next;
PER_USE_OR_RETURN(b, -1);
}
PER_ALLOW_DEACTIVATION(b);
- PER_ACCESSED(b);
+ PyPersist_SetATime(b);
Py_DECREF(b);
return r >= 0 ? r : 0;
@@ -189,7 +189,7 @@
if (b==NULL) goto no_match;
PER_ALLOW_DEACTIVATION(currentbucket);
- PER_ACCESSED(currentbucket);
+ PyPersist_SetATime(currentbucket);
ASSIGNB(currentbucket, b);
UNLESS (PER_USE(currentbucket)) goto err;
@@ -229,7 +229,7 @@
pseudoindex += (currentbucket->len - currentoffset);
Py_INCREF(b);
PER_ALLOW_DEACTIVATION(currentbucket);
- PER_ACCESSED(currentbucket);
+ PyPersist_SetATime(currentbucket);
ASSIGNB(currentbucket, b);
UNLESS (PER_USE(currentbucket)) goto err;
currentoffset = 0;
=== Zope3/lib/python/Persistence/BTrees/BTreeModuleTemplate.c 1.1.2.9 => 1.1.2.10 ===
if (first->next == current) {
PER_ALLOW_DEACTIVATION(first);
- PER_ACCESSED(first);
+ PyPersist_SetATime(first);
return first;
} else if (first->next) {
Bucket *next = first->next;
Py_INCREF(next);
PER_ALLOW_DEACTIVATION(first);
- PER_ACCESSED(first);
+ PyPersist_SetATime(first);
Py_DECREF(first);
first = next;
} else {
PER_ALLOW_DEACTIVATION(first);
- PER_ACCESSED(first);
+ PyPersist_SetATime(first);
Py_DECREF(first);
IndexError(i);
return NULL;
@@ -300,11 +300,11 @@
init_persist_type(PyTypeObject *type)
{
type->ob_type = &PyType_Type;
- type->tp_base = PyPersist_TYPE;
+ type->tp_base = PyPersist_BASE_TYPE;
/* XXX for now */
- type->tp_traverse = PyPersist_TYPE->tp_traverse;
- type->tp_clear = PyPersist_TYPE->tp_clear;
+ type->tp_traverse = PyPersist_BASE_TYPE->tp_traverse;
+ type->tp_clear = PyPersist_BASE_TYPE->tp_clear;
if (PyType_Ready(type) < 0)
return -1;
=== Zope3/lib/python/Persistence/BTrees/BTreeTemplate.c 1.1.2.8 => 1.1.2.9 ===
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return r;
}
@@ -106,7 +106,7 @@
next->firstbucket = BTREE(next->data->value)->firstbucket;
Py_XINCREF(next->firstbucket);
PyPersist_DECREF(BTREE(next->data->value));
- PER_ACCESSED(BTREE(next->data->value));
+ PyPersist_SetATime(BTREE(next->data->value));
} else {
next->firstbucket = BUCKET(next->data->value);
Py_XINCREF(next->firstbucket);
@@ -294,7 +294,7 @@
return NULL;
ASSIGN(o, OBJECT(BTree_lastBucket(self)));
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return (Bucket *)o;
}
@@ -315,7 +315,7 @@
goto err;
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return 0;
@@ -447,7 +447,7 @@
BTREE(self->data->value)->firstbucket);
Py_XINCREF(self->firstbucket);
PyPersist_DECREF(BTREE(self->data->value));
- PER_ACCESSED(BTREE(self->data->value));
+ PyPersist_SetATime(BTREE(self->data->value));
} else {
ASSIGNB(self->firstbucket,
BUCKET(self->data->value));
@@ -478,12 +478,12 @@
#endif
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return grew;
err:
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return -1;
}
@@ -582,14 +582,14 @@
}
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
Py_INCREF(Py_None);
return Py_None;
err:
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return NULL;
}
@@ -641,13 +641,13 @@
}
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return r;
err:
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
Py_XDECREF(r);
return NULL;
}
@@ -741,7 +741,7 @@
PER_PREVENT_DEACTIVATION(self);
r = _BTree_setstate(self, arg, 0);
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
if (r < 0)
return NULL;
@@ -865,7 +865,7 @@
return -1;
i = BTree_findRangeEnd(self, keyarg, low, bucket, offset);
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
}
else
{
@@ -913,7 +913,7 @@
goto empty;
}
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
PER_USE_OR_RETURN(bucket, NULL);
}
else if (min)
@@ -921,7 +921,7 @@
bucket = self->firstbucket;
Py_INCREF(bucket);
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
PER_USE_OR_RETURN(bucket, NULL);
offset = 0;
if (offset >= bucket->len)
@@ -937,7 +937,7 @@
{
bucket = BTree_lastBucket(self);
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
PER_USE_OR_RETURN(bucket, NULL);
if (bucket->len)
offset = bucket->len - 1;
@@ -953,7 +953,7 @@
COPY_KEY_TO_OBJECT(key, bucket->keys[offset]);
PyPersist_DECREF(bucket);
- PER_ACCESSED(bucket);
+ PyPersist_SetATime(bucket);
Py_DECREF(bucket);
return key;
@@ -963,11 +963,11 @@
err:
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
if (bucket)
{
PyPersist_DECREF(bucket);
- PER_ACCESSED(bucket);
+ PyPersist_SetATime(bucket);
Py_DECREF(bucket);
}
return NULL;
@@ -1044,11 +1044,11 @@
UNLESS (PER_USE(highbucket)) goto err;
highoffset = highbucket->len - 1;
PyPersist_DECREF(highbucket);
- PER_ACCESSED(highbucket);
+ PyPersist_SetATime(highbucket);
}
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
f=newBTreeItems(type, lowbucket, lowoffset, highbucket, highoffset);
Py_DECREF(lowbucket);
@@ -1057,12 +1057,12 @@
err:
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return NULL;
empty:
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return newBTreeItems(type, 0, 0, 0, 0);
}
@@ -1151,12 +1151,12 @@
Py_DECREF(item);
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return r;
err:
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
Py_XDECREF(r);
Py_XDECREF(it.set);
Py_XDECREF(item);
@@ -1275,7 +1275,7 @@
BTree_dealloc(BTree *self)
{
_BTree_clear(self);
- PyPersist_TYPE->tp_dealloc((PyObject *)self);
+ PyPersist_BASE_TYPE->tp_dealloc((PyObject *)self);
}
static int
@@ -1326,7 +1326,7 @@
b = self->firstbucket;
Py_XINCREF(b);
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
while (b != NULL)
{
@@ -1336,14 +1336,14 @@
{
/* Short-circuit if all we care about is nonempty */
PyPersist_DECREF(b);
- PER_ACCESSED(b);
+ PyPersist_SetATime(b);
Py_DECREF(b);
return 1;
}
n = b->next;
Py_XINCREF(n);
PyPersist_DECREF(b);
- PER_ACCESSED(b);
+ PyPersist_SetATime(b);
ASSIGNB(b, n);
}
=== Zope3/lib/python/Persistence/BTrees/BucketTemplate.c 1.1.2.8 => 1.1.2.9 ===
}
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return r;
}
else max=i;
}
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
if (has_key) return PyInt_FromLong(0);
PyErr_SetObject(PyExc_KeyError, keyarg);
@@ -156,7 +156,7 @@
if (VALUE_SAME(self->values[i], value))
{ /* short-circuit if no change */
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return 0;
}
#endif
@@ -167,7 +167,7 @@
if (PER_CHANGED(self) < 0) goto err;
}
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return 0;
}
else /* There's no value so remove the item */
@@ -202,7 +202,7 @@
if (PER_CHANGED(self) < 0) goto err;
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return 1;
}
}
@@ -243,12 +243,12 @@
if (PER_CHANGED(self) < 0) goto err;
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return 1;
err:
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return -1;
}
@@ -408,7 +408,7 @@
*r = self->next;
Py_XINCREF(*r);
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return 0;
}
@@ -427,11 +427,11 @@
PER_CHANGED(self);
}
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return 0;
err:
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return -1;
}
/*
@@ -470,7 +470,7 @@
else if (cmp == 0)
{
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
*offset=i;
return 1;
}
@@ -501,7 +501,7 @@
}
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return i;
}
@@ -532,14 +532,14 @@
COPY_KEY_TO_OBJECT(key, self->keys[offset]);
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return key;
empty:
PyErr_SetString(PyExc_ValueError, "empty bucket");
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return NULL;
}
@@ -627,12 +627,12 @@
}
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return r;
err:
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
Py_XDECREF(r);
return NULL;
}
@@ -667,12 +667,12 @@
}
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return r;
err:
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
Py_XDECREF(r);
return NULL;
}
@@ -717,12 +717,12 @@
}
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return r;
err:
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
Py_XDECREF(r);
Py_XDECREF(item);
return NULL;
@@ -781,12 +781,12 @@
Py_DECREF(item);
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return r;
err:
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
Py_XDECREF(r);
Py_XDECREF(item);
return NULL;
@@ -849,13 +849,13 @@
goto err;
}
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
Py_INCREF(Py_None);
return Py_None;
err:
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return NULL;
}
@@ -905,13 +905,13 @@
Py_DECREF(items);
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return state;
err:
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
Py_XDECREF(items);
return NULL;
}
@@ -990,7 +990,7 @@
PER_PREVENT_DEACTIVATION(self);
r = _bucket_setstate(self, state);
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
if (r < 0)
return NULL;
@@ -1141,8 +1141,6 @@
if (!PyArg_ParseTuple(args, "|O:" MOD_NAME_PREFIX "Bucket", &v))
return -1;
-/* fprintf(stderr, "Bucket_init %X\n", self); */
-
if (v)
return update_from_seq(self, v);
else
@@ -1152,9 +1150,8 @@
static void
bucket_dealloc(Bucket *self)
{
-/* fprintf(stderr, "bucket_dealloc %X\n", self); */
_bucket_clear(self);
- PyPersist_TYPE->tp_dealloc((PyObject *)self);
+ PyPersist_BASE_TYPE->tp_dealloc((PyObject *)self);
}
static int
@@ -1209,7 +1206,7 @@
return -1;
r = self->len;
PyPersist_DECREF(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return r;
}
@@ -1308,7 +1305,7 @@
else
{
i->position = -1;
- PER_ACCESSED(BUCKET(i->set));
+ PyPersist_SetATime(BUCKET(i->set));
}
PyPersist_DECREF(BUCKET(i->set));
=== Zope3/lib/python/Persistence/BTrees/SetOpTemplate.c 1.1.2.1 => 1.1.2.2 ===
{
i->position = -1;
- PER_ACCESSED(INTSET(i->set));
+ PyPersist_SetATime(INTSET(i->set));
}
PER_ALLOW_DEACTIVATION(INTSET(i->set));
=== Zope3/lib/python/Persistence/BTrees/SetTemplate.c 1.1.2.7 => 1.1.2.8 ===
r=_set_setstate(self, args);
PER_ALLOW_DEACTIVATION(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
if (r < 0) return NULL;
Py_INCREF(Py_None);
@@ -241,7 +241,7 @@
PER_USE_OR_RETURN(self, -1);
r = self->len;
PER_ALLOW_DEACTIVATION(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return r;
}
@@ -260,7 +260,7 @@
IndexError(index);
PER_ALLOW_DEACTIVATION(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
return r;
}
@@ -340,7 +340,7 @@
else
{
i->position = -1;
- PER_ACCESSED(BUCKET(i->set));
+ PyPersist_SetATime(BUCKET(i->set));
}
PER_ALLOW_DEACTIVATION(BUCKET(i->set));
=== Zope3/lib/python/Persistence/BTrees/TreeSetTemplate.c 1.1.2.5 => 1.1.2.6 ===
r=_BTree_setstate(self, args, 1);
PER_ALLOW_DEACTIVATION(self);
- PER_ACCESSED(self);
+ PyPersist_SetATime(self);
if (r < 0) return NULL;
Py_INCREF(Py_None);