mirror of
https://github.com/python/cpython.git
synced 2025-11-11 14:44:57 +00:00
Minor beautification. Move struct definitions to the top. Fix-up a comment.
This commit is contained in:
parent
f30f5b9ba6
commit
30c9074b96
1 changed files with 15 additions and 15 deletions
|
|
@ -15,9 +15,9 @@
|
||||||
|
|
||||||
/* The block length may be set to any number over 1. Larger numbers
|
/* The block length may be set to any number over 1. Larger numbers
|
||||||
* reduce the number of calls to the memory allocator, give faster
|
* reduce the number of calls to the memory allocator, give faster
|
||||||
* indexing and rotation, and reduce the link::data overhead ratio.
|
* indexing and rotation, and reduce the link to data overhead ratio.
|
||||||
* Making the block length a power of two speeds-up the modulo
|
* Making the block length a power of two speeds-up the modulo
|
||||||
* calculation in deque_item().
|
* and division calculations in deque_item() and deque_ass_item().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define BLOCKLEN 64
|
#define BLOCKLEN 64
|
||||||
|
|
@ -56,6 +56,19 @@ typedef struct BLOCK {
|
||||||
struct BLOCK *rightlink;
|
struct BLOCK *rightlink;
|
||||||
} block;
|
} block;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyObject_VAR_HEAD
|
||||||
|
block *leftblock;
|
||||||
|
block *rightblock;
|
||||||
|
Py_ssize_t leftindex; /* in range(BLOCKLEN) */
|
||||||
|
Py_ssize_t rightindex; /* in range(BLOCKLEN) */
|
||||||
|
long state; /* incremented whenever the indices move */
|
||||||
|
Py_ssize_t maxlen;
|
||||||
|
PyObject *weakreflist; /* List of weak references */
|
||||||
|
} dequeobject;
|
||||||
|
|
||||||
|
static PyTypeObject deque_type;
|
||||||
|
|
||||||
/* For debug builds, add error checking to track the endpoints
|
/* For debug builds, add error checking to track the endpoints
|
||||||
* in the chain of links. The goal is to make sure that link
|
* in the chain of links. The goal is to make sure that link
|
||||||
* assignments only take place at endpoints so that links already
|
* assignments only take place at endpoints so that links already
|
||||||
|
|
@ -119,19 +132,6 @@ freeblock(block *b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
PyObject_VAR_HEAD
|
|
||||||
block *leftblock;
|
|
||||||
block *rightblock;
|
|
||||||
Py_ssize_t leftindex; /* in range(BLOCKLEN) */
|
|
||||||
Py_ssize_t rightindex; /* in range(BLOCKLEN) */
|
|
||||||
long state; /* incremented whenever the indices move */
|
|
||||||
Py_ssize_t maxlen;
|
|
||||||
PyObject *weakreflist; /* List of weak references */
|
|
||||||
} dequeobject;
|
|
||||||
|
|
||||||
static PyTypeObject deque_type;
|
|
||||||
|
|
||||||
/* XXX Todo:
|
/* XXX Todo:
|
||||||
If aligned memory allocations become available, make the
|
If aligned memory allocations become available, make the
|
||||||
deque object 64 byte aligned so that all of the fields
|
deque object 64 byte aligned so that all of the fields
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue