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