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

Tim Peters tim.one@comcast.net
Mon, 17 Jun 2002 14:26:40 -0400


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

Modified Files:
	BTreeTemplate.c 
Log Message:
BTree_grow():  semantically neutral edits, to reduce the differences
between the Zope2 and Zope3 versions.


=== Zope/lib/python/BTrees/BTreeTemplate.c 1.55 => 1.56 ===
 {
   int i;
-  Sized *v, *e=0;
+  Sized *v, *e = 0;
   BTreeItem *d;
 
   if (self->len == self->size)
     {
       if (self->size)
         {
-          UNLESS (d=PyRealloc(self->data, sizeof(BTreeItem)*self->size*2))
+          d = PyRealloc(self->data, sizeof(BTreeItem)*self->size*2);
+          if (d == NULL)
             return -1;
-          self->data=d;
+          self->data = d;
           self->size *= 2;
         }
       else
         {
-          UNLESS (d=PyMalloc(sizeof(BTreeItem)*2))
+          d = PyMalloc(sizeof(BTreeItem)*2);
+          if (d == NULL)
             return -1;
-          self->data=d;
+          self->data = d;
           self->size = 2;
         }
     }
 
-  d=self->data+index;
+  d = self->data + index;
   if (self->len)
     {
       v = d->child;
@@ -221,11 +223,11 @@
       /* 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));
+          i = bucket_split(BUCKET(v), -1, BUCKET(e));
         }
       PER_ALLOW_DEACTIVATION(v);
 
@@ -254,7 +256,7 @@
           COPY_KEY(d->key, BUCKET(e)->keys[0]);
           INCREF_KEY(d->key);
         }
-      d->child=e;
+      d->child = e;
 
       self->len++;
 
@@ -272,7 +274,7 @@
           d->child = SIZED(PyObject_CallObject(OBJECT(&BucketType), NULL));
           UNLESS (d->child) return -1;
         }
-      self->len=1;
+      self->len = 1;
       Py_INCREF(d->child);
       self->firstbucket = BUCKET(d->child);
     }