diff options
author | Raymond Hettinger <python@rcn.com> | 2015-03-03 07:32:02 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2015-03-03 07:32:02 (GMT) |
commit | 87e691240b5b16b622a6e91acea89673de601d63 (patch) | |
tree | cab8c20c40e2144bddd1b6d41ed202d89b15a231 /Modules/_collectionsmodule.c | |
parent | f9d9c79aa85c6548395888b1142022deb4e18ee0 (diff) | |
download | cpython-87e691240b5b16b622a6e91acea89673de601d63.zip cpython-87e691240b5b16b622a6e91acea89673de601d63.tar.gz cpython-87e691240b5b16b622a6e91acea89673de601d63.tar.bz2 |
Minor neatening-up. Make assignments in same order a struct fields. Line-up comments.
Diffstat (limited to 'Modules/_collectionsmodule.c')
-rw-r--r-- | Modules/_collectionsmodule.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 96049f3..d4794be 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -158,14 +158,14 @@ deque_new(PyTypeObject *type, PyObject *args, PyObject *kwds) MARK_END(b->rightlink); assert(BLOCKLEN >= 2); + Py_SIZE(deque) = 0; deque->leftblock = b; deque->rightblock = b; deque->leftindex = CENTER + 1; deque->rightindex = CENTER; - Py_SIZE(deque) = 0; deque->state = 0; - deque->weakreflist = NULL; deque->maxlen = -1; + deque->weakreflist = NULL; return (PyObject *)deque; } @@ -775,9 +775,9 @@ deque_clear(dequeobject *deque) assert (item != NULL); Py_DECREF(item); } - assert(deque->leftblock == deque->rightblock && - deque->leftindex - 1 == deque->rightindex && - Py_SIZE(deque) == 0); + assert(deque->leftblock == deque->rightblock); + assert(deque->leftindex - 1 == deque->rightindex); + assert(Py_SIZE(deque) == 0); } static int @@ -1152,10 +1152,10 @@ static PySequenceMethods deque_as_sequence = { 0, /* sq_repeat */ (ssizeargfunc)deque_item, /* sq_item */ 0, /* sq_slice */ - (ssizeobjargproc)deque_ass_item, /* sq_ass_item */ + (ssizeobjargproc)deque_ass_item, /* sq_ass_item */ 0, /* sq_ass_slice */ 0, /* sq_contains */ - (binaryfunc)deque_inplace_concat, /* sq_inplace_concat */ + (binaryfunc)deque_inplace_concat, /* sq_inplace_concat */ 0, /* sq_inplace_repeat */ }; @@ -1254,8 +1254,8 @@ static PyTypeObject deque_type = { typedef struct { PyObject_HEAD - Py_ssize_t index; block *b; + Py_ssize_t index; dequeobject *deque; size_t state; /* state when the iterator is created */ Py_ssize_t counter; /* number of items remaining for iteration */ @@ -1374,7 +1374,7 @@ static PyMethodDef dequeiter_methods[] = { static PyTypeObject dequeiter_type = { PyVarObject_HEAD_INIT(NULL, 0) - "_collections._deque_iterator", /* tp_name */ + "_collections._deque_iterator", /* tp_name */ sizeof(dequeiterobject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ @@ -1393,7 +1393,7 @@ static PyTypeObject dequeiter_type = { PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ 0, /* tp_doc */ (traverseproc)dequeiter_traverse, /* tp_traverse */ 0, /* tp_clear */ @@ -1496,7 +1496,7 @@ dequereviter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) static PyTypeObject dequereviter_type = { PyVarObject_HEAD_INIT(NULL, 0) - "_collections._deque_reverse_iterator", /* tp_name */ + "_collections._deque_reverse_iterator", /* tp_name */ sizeof(dequeiterobject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ @@ -1515,7 +1515,7 @@ static PyTypeObject dequereviter_type = { PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ 0, /* tp_doc */ (traverseproc)dequeiter_traverse, /* tp_traverse */ 0, /* tp_clear */ |