equal
deleted
inserted
replaced
321 PyMem_Free(self->offsets); |
321 PyMem_Free(self->offsets); |
322 self->offsets = NULL; |
322 self->offsets = NULL; |
323 } |
323 } |
324 if (self->nt != NULL) { |
324 if (self->nt != NULL) { |
325 free(self->nt->nodes); |
325 free(self->nt->nodes); |
326 free(self->nt); |
326 PyMem_Free(self->nt); |
327 } |
327 } |
328 self->nt = NULL; |
328 self->nt = NULL; |
329 Py_CLEAR(self->headrevs); |
329 Py_CLEAR(self->headrevs); |
330 } |
330 } |
331 |
331 |
1104 self->nt->capacity = self->raw_length < 4 |
1104 self->nt->capacity = self->raw_length < 4 |
1105 ? 4 : (int)self->raw_length / 2; |
1105 ? 4 : (int)self->raw_length / 2; |
1106 |
1106 |
1107 self->nt->nodes = calloc(self->nt->capacity, sizeof(nodetreenode)); |
1107 self->nt->nodes = calloc(self->nt->capacity, sizeof(nodetreenode)); |
1108 if (self->nt->nodes == NULL) { |
1108 if (self->nt->nodes == NULL) { |
1109 free(self->nt); |
1109 PyMem_Free(self->nt); |
1110 self->nt = NULL; |
1110 self->nt = NULL; |
1111 PyErr_NoMemory(); |
1111 PyErr_NoMemory(); |
1112 return -1; |
1112 return -1; |
1113 } |
1113 } |
1114 self->ntrev = (int)index_length(self); |
1114 self->ntrev = (int)index_length(self); |
1117 self->nt->depth = 0; |
1117 self->nt->depth = 0; |
1118 self->nt->splits = 0; |
1118 self->nt->splits = 0; |
1119 self->nt->length = 1; |
1119 self->nt->length = 1; |
1120 if (nt_insert(self, nullid, -1) == -1) { |
1120 if (nt_insert(self, nullid, -1) == -1) { |
1121 free(self->nt->nodes); |
1121 free(self->nt->nodes); |
1122 free(self->nt); |
1122 PyMem_Free(self->nt); |
1123 self->nt = NULL; |
1123 self->nt = NULL; |
1124 return -1; |
1124 return -1; |
1125 } |
1125 } |
1126 } |
1126 } |
1127 return 0; |
1127 return 0; |