Show More
@@ -1065,7 +1065,9 b' static int nt_delete_node(nodetree *self' | |||
|
1065 | 1065 | static int nt_init(nodetree *self, indexObject *index, unsigned capacity) |
|
1066 | 1066 | { |
|
1067 | 1067 | self->index = index; |
|
1068 | self->capacity = capacity; | |
|
1068 | /* The input capacity is in terms of revisions, while the field is in | |
|
1069 | * terms of nodetree nodes. */ | |
|
1070 | self->capacity = (capacity < 4 ? 4 : capacity / 2); | |
|
1069 | 1071 | self->depth = 0; |
|
1070 | 1072 | self->splits = 0; |
|
1071 | 1073 | if ((size_t)self->capacity > INT_MAX / sizeof(nodetreenode)) { |
@@ -1141,8 +1143,7 b' static int index_init_nt(indexObject *se' | |||
|
1141 | 1143 | PyErr_NoMemory(); |
|
1142 | 1144 | return -1; |
|
1143 | 1145 | } |
|
1144 | unsigned capacity = (self->raw_length < 4 ? 4 : (int)self->raw_length / 2); | |
|
1145 | if (nt_init(self->nt, self, capacity) == -1) { | |
|
1146 | if (nt_init(self->nt, self, self->raw_length) == -1) { | |
|
1146 | 1147 | PyMem_Free(self->nt); |
|
1147 | 1148 | self->nt = NULL; |
|
1148 | 1149 | return -1; |
General Comments 0
You need to be logged in to leave comments.
Login now