Commit 8fd36a69 authored by Jeremy Hylton's avatar Jeremy Hylton

Simplify cc_invalidate() because None is no longer a valid argument.

parent 4f57e3f1
...@@ -88,7 +88,7 @@ process must skip such objects, rather than deactivating them. ...@@ -88,7 +88,7 @@ process must skip such objects, rather than deactivating them.
static char cPickleCache_doc_string[] = static char cPickleCache_doc_string[] =
"Defines the PickleCache used by ZODB Connection objects.\n" "Defines the PickleCache used by ZODB Connection objects.\n"
"\n" "\n"
"$Id: cPickleCache.c,v 1.66 2002/06/10 22:35:08 jeremy Exp $\n"; "$Id: cPickleCache.c,v 1.67 2002/06/10 22:49:41 jeremy Exp $\n";
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;} #define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define UNLESS(E) if(!(E)) #define UNLESS(E) if(!(E))
...@@ -425,23 +425,16 @@ static PyObject * ...@@ -425,23 +425,16 @@ static PyObject *
cc_invalidate(ccobject *self, PyObject *args) cc_invalidate(ccobject *self, PyObject *args)
{ {
PyObject *inv, *key, *v; PyObject *inv, *key, *v;
int i; int i = 0;
/* XXX The code supports invalidation of all objects, but it's /* Older versions of ZODB used None to mean "invalidate everything,"
impossible for a Connection object to pass None. The code could be but current Connection implementations don't ever pass None.
simplied.
*/ */
assert(key != Py_None);
if (PyArg_ParseTuple(args, "O!", &PyDict_Type, &inv)) { if (PyArg_ParseTuple(args, "O!", &PyDict_Type, &inv)) {
for (i=0; PyDict_Next(inv, &i, &key, &v); ) while (PyDict_Next(inv, &i, &key, &v))
if (key == Py_None) { _invalidate(self, key);
/* Eek some nitwit invalidated everything! */
for (i=0; PyDict_Next(self->data, &i, &key, &v); )
_invalidate(self, key);
break;
}
else
_invalidate(self, key);
PyDict_Clear(inv); PyDict_Clear(inv);
} }
else { else {
...@@ -450,9 +443,6 @@ cc_invalidate(ccobject *self, PyObject *args) ...@@ -450,9 +443,6 @@ cc_invalidate(ccobject *self, PyObject *args)
return NULL; return NULL;
if (PyString_Check(inv)) if (PyString_Check(inv))
_invalidate(self, inv); _invalidate(self, inv);
else if (inv == Py_None) /* All */
for (i=0; PyDict_Next(self->data, &i, &key, &v); )
_invalidate(self, key);
else { else {
int l; int l;
......
...@@ -88,7 +88,7 @@ process must skip such objects, rather than deactivating them. ...@@ -88,7 +88,7 @@ process must skip such objects, rather than deactivating them.
static char cPickleCache_doc_string[] = static char cPickleCache_doc_string[] =
"Defines the PickleCache used by ZODB Connection objects.\n" "Defines the PickleCache used by ZODB Connection objects.\n"
"\n" "\n"
"$Id: cPickleCache.c,v 1.66 2002/06/10 22:35:08 jeremy Exp $\n"; "$Id: cPickleCache.c,v 1.67 2002/06/10 22:49:41 jeremy Exp $\n";
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;} #define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define UNLESS(E) if(!(E)) #define UNLESS(E) if(!(E))
...@@ -425,23 +425,16 @@ static PyObject * ...@@ -425,23 +425,16 @@ static PyObject *
cc_invalidate(ccobject *self, PyObject *args) cc_invalidate(ccobject *self, PyObject *args)
{ {
PyObject *inv, *key, *v; PyObject *inv, *key, *v;
int i; int i = 0;
/* XXX The code supports invalidation of all objects, but it's /* Older versions of ZODB used None to mean "invalidate everything,"
impossible for a Connection object to pass None. The code could be but current Connection implementations don't ever pass None.
simplied.
*/ */
assert(key != Py_None);
if (PyArg_ParseTuple(args, "O!", &PyDict_Type, &inv)) { if (PyArg_ParseTuple(args, "O!", &PyDict_Type, &inv)) {
for (i=0; PyDict_Next(inv, &i, &key, &v); ) while (PyDict_Next(inv, &i, &key, &v))
if (key == Py_None) { _invalidate(self, key);
/* Eek some nitwit invalidated everything! */
for (i=0; PyDict_Next(self->data, &i, &key, &v); )
_invalidate(self, key);
break;
}
else
_invalidate(self, key);
PyDict_Clear(inv); PyDict_Clear(inv);
} }
else { else {
...@@ -450,9 +443,6 @@ cc_invalidate(ccobject *self, PyObject *args) ...@@ -450,9 +443,6 @@ cc_invalidate(ccobject *self, PyObject *args)
return NULL; return NULL;
if (PyString_Check(inv)) if (PyString_Check(inv))
_invalidate(self, inv); _invalidate(self, inv);
else if (inv == Py_None) /* All */
for (i=0; PyDict_Next(self->data, &i, &key, &v); )
_invalidate(self, key);
else { else {
int l; int l;
......
...@@ -88,7 +88,7 @@ process must skip such objects, rather than deactivating them. ...@@ -88,7 +88,7 @@ process must skip such objects, rather than deactivating them.
static char cPickleCache_doc_string[] = static char cPickleCache_doc_string[] =
"Defines the PickleCache used by ZODB Connection objects.\n" "Defines the PickleCache used by ZODB Connection objects.\n"
"\n" "\n"
"$Id: cPickleCache.c,v 1.66 2002/06/10 22:35:08 jeremy Exp $\n"; "$Id: cPickleCache.c,v 1.67 2002/06/10 22:49:41 jeremy Exp $\n";
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;} #define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define UNLESS(E) if(!(E)) #define UNLESS(E) if(!(E))
...@@ -425,23 +425,16 @@ static PyObject * ...@@ -425,23 +425,16 @@ static PyObject *
cc_invalidate(ccobject *self, PyObject *args) cc_invalidate(ccobject *self, PyObject *args)
{ {
PyObject *inv, *key, *v; PyObject *inv, *key, *v;
int i; int i = 0;
/* XXX The code supports invalidation of all objects, but it's /* Older versions of ZODB used None to mean "invalidate everything,"
impossible for a Connection object to pass None. The code could be but current Connection implementations don't ever pass None.
simplied.
*/ */
assert(key != Py_None);
if (PyArg_ParseTuple(args, "O!", &PyDict_Type, &inv)) { if (PyArg_ParseTuple(args, "O!", &PyDict_Type, &inv)) {
for (i=0; PyDict_Next(inv, &i, &key, &v); ) while (PyDict_Next(inv, &i, &key, &v))
if (key == Py_None) { _invalidate(self, key);
/* Eek some nitwit invalidated everything! */
for (i=0; PyDict_Next(self->data, &i, &key, &v); )
_invalidate(self, key);
break;
}
else
_invalidate(self, key);
PyDict_Clear(inv); PyDict_Clear(inv);
} }
else { else {
...@@ -450,9 +443,6 @@ cc_invalidate(ccobject *self, PyObject *args) ...@@ -450,9 +443,6 @@ cc_invalidate(ccobject *self, PyObject *args)
return NULL; return NULL;
if (PyString_Check(inv)) if (PyString_Check(inv))
_invalidate(self, inv); _invalidate(self, inv);
else if (inv == Py_None) /* All */
for (i=0; PyDict_Next(self->data, &i, &key, &v); )
_invalidate(self, key);
else { else {
int l; int l;
......
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