[Python-checkins] cpython: Improve variable names in deque_count()

raymond.hettinger python-checkins at python.org
Sun Jul 7 05:50:11 CEST 2013


http://hg.python.org/cpython/rev/e7025b1e69ce
changeset:   84474:e7025b1e69ce
parent:      84470:9166aa413d6f
user:        Raymond Hettinger <python at rcn.com>
date:        Sat Jul 06 17:49:06 2013 -1000
summary:
  Improve variable names in deque_count()

files:
  Modules/_collectionsmodule.c |  16 ++++++++--------
  1 files changed, 8 insertions(+), 8 deletions(-)


diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -581,8 +581,8 @@
 static PyObject *
 deque_count(dequeobject *deque, PyObject *v)
 {
-    block *leftblock = deque->leftblock;
-    Py_ssize_t leftindex = deque->leftindex;
+    block *b = deque->leftblock;
+    Py_ssize_t index = deque->leftindex;
     Py_ssize_t n = Py_SIZE(deque);
     Py_ssize_t i;
     Py_ssize_t count = 0;
@@ -591,8 +591,8 @@
     int cmp;
 
     for (i=0 ; i<n ; i++) {
-        assert(leftblock != NULL);
-        item = leftblock->data[leftindex];
+        assert(b != NULL);
+        item = b->data[index];
         cmp = PyObject_RichCompareBool(item, v, Py_EQ);
         if (cmp > 0)
             count++;
@@ -606,10 +606,10 @@
         }
 
         /* Advance left block/index pair */
-        leftindex++;
-        if (leftindex == BLOCKLEN) {
-            leftblock = leftblock->rightlink;
-            leftindex = 0;
+        index++;
+        if (index == BLOCKLEN) {
+            b = b->rightlink;
+            index = 0;
         }
     }
     return PyLong_FromSsize_t(count);

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list