[Zope-Checkins] CVS: Zope3/lib/python/Persistence/BTrees - BucketTemplate.c:1.3

Tim Peters tim.one@comcast.net
Mon, 10 Jun 2002 23:01:51 -0400


Update of /cvs-repository/Zope3/lib/python/Persistence/BTrees
In directory cvs.zope.org:/tmp/cvs-serv10813

Modified Files:
	BucketTemplate.c 
Log Message:
Changed the uses of PER_CHANGED() that weren't checking the result for
an error return.


=== Zope3/lib/python/Persistence/BTrees/BucketTemplate.c 1.2 => 1.3 ===
     self->next = next;
 
-    PER_CHANGED(self);
+    if (PER_CHANGED(self) < 0)
+        return -1;
 
     return 0;
 }
@@ -475,24 +476,28 @@
 static int
 Bucket_deleteNextBucket(Bucket *self)
 {
+    int result = -1;    /* until proven innocent */
+
     PyPersist_INCREF(self);
     if (!PyPersist_IS_STICKY(self))
 	return -1;
     if (self->next) {
 	Bucket *n;
 	if (Bucket_nextBucket(self->next, &n) < 0)
-	    goto err;
+	    goto Done;
 	Py_DECREF(self->next);
 	self->next = n;
-	PER_CHANGED(self);
+	if (PER_CHANGED(self) < 0)
+	    goto Done;
     }
     PyPersist_DECREF(self);
     PyPersist_SetATime(self);
-    return 0;
- err:
+    result = 0;
+
+Done:
     PyPersist_DECREF(self);
     PyPersist_SetATime(self);
-    return -1;
+    return result;
 }
 
 /*