[Zodb-checkins] SVN: ZODB/branches/alienoid-btrees_pop/src/BTrees/B more cleanup and added comment about `nonzero` parameter.

Ruslan Spivak rspivak at nuxeo.com
Tue Aug 30 17:09:52 EDT 2005


Log message for revision 38171:
  more cleanup and added comment about `nonzero` parameter.

Changed:
  U   ZODB/branches/alienoid-btrees_pop/src/BTrees/BTreeTemplate.c
  U   ZODB/branches/alienoid-btrees_pop/src/BTrees/BucketTemplate.c

-=-
Modified: ZODB/branches/alienoid-btrees_pop/src/BTrees/BTreeTemplate.c
===================================================================
--- ZODB/branches/alienoid-btrees_pop/src/BTrees/BTreeTemplate.c	2005-08-30 21:01:34 UTC (rev 38170)
+++ ZODB/branches/alienoid-btrees_pop/src/BTrees/BTreeTemplate.c	2005-08-30 21:09:52 UTC (rev 38171)
@@ -1758,11 +1758,12 @@
     if (! PyErr_ExceptionMatches(PyExc_KeyError))
         return NULL;
 
-    int nonzero = 1;
+    int nonzero = 1; /* request just a non-empty/empty result */
     int res = BTree_length_or_nonzero(self, nonzero);
-    if (res < 0) {
+    if (res < 0)
         return NULL;
-    } else if (!res) {
+
+    if (! res) {
         /* btree is empty */
         if (failobj == NULL) {
             PyErr_SetString(PyExc_KeyError, "pop(): dictionary is empty");

Modified: ZODB/branches/alienoid-btrees_pop/src/BTrees/BucketTemplate.c
===================================================================
--- ZODB/branches/alienoid-btrees_pop/src/BTrees/BucketTemplate.c	2005-08-30 21:01:34 UTC (rev 38170)
+++ ZODB/branches/alienoid-btrees_pop/src/BTrees/BucketTemplate.c	2005-08-30 21:09:52 UTC (rev 38171)
@@ -1319,9 +1319,10 @@
         return NULL;
 
     int res = Bucket_length(self);
-    if (res < 0) {
+    if (res < 0)
         return NULL;
-    } else if (!res) {
+
+    if (! res) {
         /* bucket is empty */
         if (failobj == NULL) {
             PyErr_SetString(PyExc_KeyError, "pop(): dictionary is empty");



More information about the Zodb-checkins mailing list