diff options
author | Raymond Hettinger <python@rcn.com> | 2013-02-07 05:57:19 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2013-02-07 05:57:19 (GMT) |
commit | 59cf23ab076b60474b4906d31774c9cb727b6e3f (patch) | |
tree | 7149f5222a896333dbf723c440a4c56cafe9bc47 /Modules/_collectionsmodule.c | |
parent | 09f336ceb00a34ff8cb3b57d62f43f755c86f3a9 (diff) | |
download | cpython-59cf23ab076b60474b4906d31774c9cb727b6e3f.zip cpython-59cf23ab076b60474b4906d31774c9cb727b6e3f.tar.gz cpython-59cf23ab076b60474b4906d31774c9cb727b6e3f.tar.bz2 |
Minor tweaks to varnames, declarations, and comments.
Diffstat (limited to 'Modules/_collectionsmodule.c')
-rw-r--r-- | Modules/_collectionsmodule.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index a10e615..a23f714 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -9,7 +9,7 @@ /* The block length may be set to any number over 1. Larger numbers * reduce the number of calls to the memory allocator but take more - * memory. Ideally, BLOCKLEN should be set to a multiple of the + * memory. Ideally, (BLOCKLEN+2) should be set to a multiple of the * length of a cache line. */ @@ -71,7 +71,7 @@ newblock(block *leftlink, block *rightlink, Py_ssize_t len) { return NULL; } if (numfreeblocks) { - numfreeblocks -= 1; + numfreeblocks--; b = freeblocks[numfreeblocks]; } else { b = PyMem_Malloc(sizeof(block)); @@ -414,7 +414,6 @@ static int _deque_rotate(dequeobject *deque, Py_ssize_t n) { Py_ssize_t m, len=deque->len, halflen=len>>1; - block *prevblock; if (len <= 1) return 0; @@ -455,8 +454,8 @@ _deque_rotate(dequeobject *deque, Py_ssize_t n) n -= m; if (deque->rightindex == -1) { + block *prevblock = deque->rightblock->leftlink; assert(deque->rightblock != NULL); - prevblock = deque->rightblock->leftlink; assert(deque->leftblock != deque->rightblock); freeblock(deque->rightblock); prevblock->rightlink = NULL; @@ -490,12 +489,12 @@ _deque_rotate(dequeobject *deque, Py_ssize_t n) n += m; if (deque->leftindex == BLOCKLEN) { + block *nextblock = deque->leftblock->rightlink; assert(deque->leftblock != deque->rightblock); - prevblock = deque->leftblock->rightlink; freeblock(deque->leftblock); - assert(prevblock != NULL); - prevblock->leftlink = NULL; - deque->leftblock = prevblock; + assert(nextblock != NULL); + nextblock->leftlink = NULL; + deque->leftblock = nextblock; deque->leftindex = 0; } } |