[Python-checkins] cpython: Put block length computations in a more logical order.

raymond.hettinger python-checkins at python.org
Wed Mar 2 03:06:26 EST 2016


https://hg.python.org/cpython/rev/2b2497285087
changeset:   100384:2b2497285087
user:        Raymond Hettinger <python at rcn.com>
date:        Wed Mar 02 00:06:21 2016 -0800
summary:
  Put block length computations in a more logical order.

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


diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -589,8 +589,8 @@
     /* Now the old size, leftblock, and leftindex are disconnected from
        the empty deque and we can use them to decref the pointers.
     */
+    m = (BLOCKLEN - leftindex > n) ? n : BLOCKLEN - leftindex;
     itemptr = &leftblock->data[leftindex];
-    m = (BLOCKLEN - leftindex > n) ? n : BLOCKLEN - leftindex;
     limit = &leftblock->data[leftindex + m];
     n -= m;
     while (1) {
@@ -600,8 +600,8 @@
             CHECK_NOT_END(leftblock->rightlink);
             prevblock = leftblock;
             leftblock = leftblock->rightlink;
+            m = (n > BLOCKLEN) ? BLOCKLEN : n;
             itemptr = leftblock->data;
-            m = (n > BLOCKLEN) ? BLOCKLEN : n;
             limit = &leftblock->data[m];
             n -= m;
             freeblock(prevblock);

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


More information about the Python-checkins mailing list