[Zope-Checkins] CVS: StandaloneZODB/ZODB - cPickleCache.c:1.44

Jeremy Hylton jeremy@zope.com
Mon, 1 Apr 2002 18:45:49 -0500


Update of /cvs-repository/StandaloneZODB/ZODB
In directory cvs.zope.org:/tmp/cvs-serv3329

Modified Files:
	cPickleCache.c 
Log Message:
Cache cleanups.

Remove use of staticforward.

Avoid forward reference to Cctype by defining newccobject after type
struct.


=== StandaloneZODB/ZODB/cPickleCache.c 1.43 => 1.44 ===
 #include <time.h>
 #include <stddef.h>
-
 #undef Py_FindMethod
 
-
 static PyObject *py__p_oid, *py_reload, *py__p_jar, *py__p_changed;
 
 /* define this for extra debugging checks, and lousy performance */
@@ -55,16 +53,13 @@
     int cache_drain_resistance;
 } ccobject;
 
-staticforward PyTypeObject Cctype;
-
-
-staticforward int present_in_ring(ccobject *self,CPersistentRing *target);
-staticforward int check_ring(ccobject *self,const char *context);
-staticforward int cc_ass_sub(ccobject *self, PyObject *key, PyObject *v);
+static int present_in_ring(ccobject *self, CPersistentRing *target);
+static int check_ring(ccobject *self, const char *context);
+static int cc_ass_sub(ccobject *self, PyObject *key, PyObject *v);
 
 /* ---------------------------------------------------------------- */
 
-static PyObject *object_from_oid(ccobject *self,PyObject *key)
+static PyObject *object_from_oid(ccobject *self, PyObject *key)
 /* somewhat of a replacement for PyDict_GetItem(self->data....
    however this returns a *new* reference */
 {
@@ -537,32 +532,6 @@
   {NULL,		NULL}		/* sentinel */
 };
 
-static ccobject *
-newccobject(PyObject *jar, int cache_size, int cache_age)
-{
-  ccobject *self;
-  
-  UNLESS(self = PyObject_NEW(ccobject, &Cctype)) return NULL;
-  self->setklassstate=self->jar=NULL;
-  if((self->data=PyDict_New()))
-    {
-      self->jar=jar; 
-      Py_INCREF(jar);
-      UNLESS (self->setklassstate=PyObject_GetAttrString(jar, "setklassstate"))
-	return NULL;
-      self->cache_size=cache_size;
-      self->non_ghost_count=0;
-      self->klass_count=0;
-      self->cache_drain_resistance=0;
-      self->ring_lock=0;
-      self->ring_home.next = &self->ring_home;
-      self->ring_home.prev = &self->ring_home;
-      return self;
-    }
-  Py_DECREF(self);
-  return NULL;
-}
-
 static void
 cc_dealloc(ccobject *self)
 {
@@ -920,6 +889,32 @@
   0L,0L,0L,0L,
   ""
 };
+
+static ccobject *
+newccobject(PyObject *jar, int cache_size, int cache_age)
+{
+  ccobject *self;
+  
+  UNLESS(self = PyObject_NEW(ccobject, &Cctype)) return NULL;
+  self->setklassstate=self->jar=NULL;
+  if((self->data=PyDict_New()))
+    {
+      self->jar=jar; 
+      Py_INCREF(jar);
+      UNLESS (self->setklassstate=PyObject_GetAttrString(jar, "setklassstate"))
+	return NULL;
+      self->cache_size=cache_size;
+      self->non_ghost_count=0;
+      self->klass_count=0;
+      self->cache_drain_resistance=0;
+      self->ring_lock=0;
+      self->ring_home.next = &self->ring_home;
+      self->ring_home.prev = &self->ring_home;
+      return self;
+    }
+  Py_DECREF(self);
+  return NULL;
+}
 
 static PyObject *
 cCM_new(PyObject *self, PyObject *args)