From d09403deb5a34acd208f54f0b0cd083484d9b10e Mon Sep 17 00:00:00 2001 From: Tim Peters <tim.one@comcast.net> Date: Tue, 11 Jun 2002 02:59:05 +0000 Subject: [PATCH] Changed the uses of PER_CHANGED() that weren't checking the result for an error return. --- src/BTrees/BTreeTemplate.c | 5 +++-- src/BTrees/BucketTemplate.c | 21 ++++++++++++--------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/BTrees/BTreeTemplate.c b/src/BTrees/BTreeTemplate.c index 7d94168d..89718832 100755 --- a/src/BTrees/BTreeTemplate.c +++ b/src/BTrees/BTreeTemplate.c @@ -12,7 +12,7 @@ ****************************************************************************/ -#define BTREETEMPLATE_C "$Id: BTreeTemplate.c,v 1.42 2002/06/11 02:37:57 tim_one Exp $\n" +#define BTREETEMPLATE_C "$Id: BTreeTemplate.c,v 1.43 2002/06/11 02:59:05 tim_one Exp $\n" /* ** _BTree_get @@ -111,7 +111,8 @@ BTree_split(BTree *self, int index, BTree *next) Py_XINCREF(next->firstbucket); } - PER_CHANGED(self); + if (PER_CHANGED(self) < 0) + return -1; return 0; } diff --git a/src/BTrees/BucketTemplate.c b/src/BTrees/BucketTemplate.c index 6009c5e0..369048a5 100755 --- a/src/BTrees/BucketTemplate.c +++ b/src/BTrees/BucketTemplate.c @@ -12,7 +12,7 @@ ****************************************************************************/ -#define BUCKETTEMPLATE_C "$Id: BucketTemplate.c,v 1.38 2002/06/09 05:56:25 tim_one Exp $\n" +#define BUCKETTEMPLATE_C "$Id: BucketTemplate.c,v 1.39 2002/06/11 02:59:05 tim_one Exp $\n" /* Use BUCKET_SEARCH to find the index at which a key belongs. * INDEX An int lvalue to hold the index i such that KEY belongs at @@ -440,7 +440,8 @@ bucket_split(Bucket *self, int index, Bucket *next) Py_INCREF(next); self->next = next; - PER_CHANGED(self); + if (PER_CHANGED(self) < 0) + return -1; return 0; } @@ -459,21 +460,23 @@ Bucket_nextBucket(Bucket *self, Bucket **r) static int Bucket_deleteNextBucket(Bucket *self) { + int result = -1; /* until proven innocent */ + PER_USE_OR_RETURN(self, -1); if (self->next) { Bucket *n; - if (Bucket_nextBucket(self->next, &n) < 0) goto err; + if (Bucket_nextBucket(self->next, &n) < 0) goto Done; ASSIGNB(self->next, n); - PER_CHANGED(self); + if (PER_CHANGED(self) < 0) + goto Done; } + result = 0; + +Done: PER_ALLOW_DEACTIVATION(self); PER_ACCESSED(self); - return 0; - err: - PER_ALLOW_DEACTIVATION(self); - PER_ACCESSED(self); - return -1; + return result; } /* -- 2.30.9