Show More
@@ -28,6 +28,8 b'' | |||||
28 | #define PyInt_AsLong PyLong_AsLong |
|
28 | #define PyInt_AsLong PyLong_AsLong | |
29 | #endif |
|
29 | #endif | |
30 |
|
30 | |||
|
31 | typedef struct indexObjectStruct indexObject; | |||
|
32 | ||||
31 | typedef struct { |
|
33 | typedef struct { | |
32 | int children[16]; |
|
34 | int children[16]; | |
33 | } nodetreenode; |
|
35 | } nodetreenode; | |
@@ -40,6 +42,7 b' typedef struct {' | |||||
40 | * Zero is empty |
|
42 | * Zero is empty | |
41 | */ |
|
43 | */ | |
42 | typedef struct { |
|
44 | typedef struct { | |
|
45 | indexObject *index; | |||
43 | nodetreenode *nodes; |
|
46 | nodetreenode *nodes; | |
44 | unsigned length; /* # nodes in use */ |
|
47 | unsigned length; /* # nodes in use */ | |
45 | unsigned capacity; /* # nodes allocated */ |
|
48 | unsigned capacity; /* # nodes allocated */ | |
@@ -59,7 +62,7 b' typedef struct {' | |||||
59 | * With string keys, we lazily perform a reverse mapping from node to |
|
62 | * With string keys, we lazily perform a reverse mapping from node to | |
60 | * rev, using a base-16 trie. |
|
63 | * rev, using a base-16 trie. | |
61 | */ |
|
64 | */ | |
62 | typedef struct { |
|
65 | struct indexObjectStruct { | |
63 | PyObject_HEAD |
|
66 | PyObject_HEAD | |
64 | /* Type-specific fields go here. */ |
|
67 | /* Type-specific fields go here. */ | |
65 | PyObject *data; /* raw bytes of index */ |
|
68 | PyObject *data; /* raw bytes of index */ | |
@@ -76,7 +79,7 b' typedef struct {' | |||||
76 | int ntlookups; /* # lookups */ |
|
79 | int ntlookups; /* # lookups */ | |
77 | int ntmisses; /* # lookups that miss the cache */ |
|
80 | int ntmisses; /* # lookups that miss the cache */ | |
78 | int inlined; |
|
81 | int inlined; | |
79 | } indexObject; |
|
82 | }; | |
80 |
|
83 | |||
81 | static Py_ssize_t index_length(const indexObject *self) |
|
84 | static Py_ssize_t index_length(const indexObject *self) | |
82 | { |
|
85 | { | |
@@ -1120,6 +1123,7 b' static int nt_init(indexObject *self)' | |||||
1120 | self->nt->depth = 0; |
|
1123 | self->nt->depth = 0; | |
1121 | self->nt->splits = 0; |
|
1124 | self->nt->splits = 0; | |
1122 | self->nt->length = 1; |
|
1125 | self->nt->length = 1; | |
|
1126 | self->nt->index = self; | |||
1123 | if (nt_insert(self, nullid, -1) == -1) { |
|
1127 | if (nt_insert(self, nullid, -1) == -1) { | |
1124 | free(self->nt->nodes); |
|
1128 | free(self->nt->nodes); | |
1125 | PyMem_Free(self->nt); |
|
1129 | PyMem_Free(self->nt); |
General Comments 0
You need to be logged in to leave comments.
Login now