Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b97cc49

Browse files
committed
Minor code simplification by eliminating an unnecessary temporary variable.
1 parent 02e8b53 commit b97cc49

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

Modules/_collectionsmodule.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,6 @@ _deque_rotate(dequeobject *deque, Py_ssize_t n)
491491
b = NULL;
492492
}
493493
assert(leftindex > 0);
494-
495494
{
496495
PyObject **src, **dest;
497496
Py_ssize_t m = n;
@@ -510,15 +509,13 @@ _deque_rotate(dequeobject *deque, Py_ssize_t n)
510509
*(dest--) = *(src--);
511510
} while (--m);
512511
}
513-
514512
if (rightindex == -1) {
515-
block *prevblock = rightblock->leftlink;
516513
assert(leftblock != rightblock);
517514
assert(b == NULL);
518515
b = rightblock;
519-
CHECK_NOT_END(prevblock);
520-
MARK_END(prevblock->rightlink);
521-
rightblock = prevblock;
516+
CHECK_NOT_END(rightblock->leftlink);
517+
rightblock = rightblock->leftlink;
518+
MARK_END(rightblock->rightlink);
522519
rightindex = BLOCKLEN - 1;
523520
}
524521
}
@@ -538,7 +535,6 @@ _deque_rotate(dequeobject *deque, Py_ssize_t n)
538535
b = NULL;
539536
}
540537
assert (rightindex < BLOCKLEN - 1);
541-
542538
{
543539
PyObject **src, **dest;
544540
Py_ssize_t m = -n;
@@ -557,15 +553,13 @@ _deque_rotate(dequeobject *deque, Py_ssize_t n)
557553
*(dest++) = *(src++);
558554
} while (--m);
559555
}
560-
561556
if (leftindex == BLOCKLEN) {
562-
block *nextblock = leftblock->rightlink;
563557
assert(leftblock != rightblock);
564558
assert(b == NULL);
565559
b = leftblock;
566-
CHECK_NOT_END(nextblock);
567-
MARK_END(nextblock->leftlink);
568-
leftblock = nextblock;
560+
CHECK_NOT_END(leftblock->rightlink);
561+
leftblock = leftblock->rightlink;
562+
MARK_END(leftblock->leftlink);
569563
leftindex = 0;
570564
}
571565
}

0 commit comments

Comments
 (0)