[Zodb-checkins] CVS: Zope/lib/python/BTrees - BTreeTemplate.c:1.42

Tim Peters tim.one@comcast.net
Mon, 10 Jun 2002 22:37:57 -0400


Update of /cvs-repository/Zope/lib/python/BTrees
In directory cvs.zope.org:/tmp/cvs-serv5145

Modified Files:
	BTreeTemplate.c 
Log Message:
BTree_grow():  eliminated needless casting.  Fixed places where an
error return let a newly allocated object leak; curiously, there was
one more of these in the Zope3 version of the code than on the trunk.


=== Zope/lib/python/BTrees/BTreeTemplate.c 1.41 => 1.42 ===
       UNLESS (e) return -1;
 
-      PER_USE_OR_RETURN(BUCKET(v), -1);
-
+      UNLESS(PER_USE(v))
+        {
+          Py_DECREF(e);
+          return -1;
+        }
 
       /* Now split between the original (v) and the new (e) at the midpoint*/
       if (SameType_Check(self, v))
         {
-          i=BTree_split(  BTREE(v), -1,   BTREE(e));
+          i=BTree_split(BTREE(v), -1,   BTREE(e));
         }
       else
         {
           i=bucket_split(BUCKET(v), -1, BUCKET(e));
         }
-
-      PER_ALLOW_DEACTIVATION(BUCKET(v));
+      PER_ALLOW_DEACTIVATION(v);
 
       if (i < 0)
         {