equal
deleted
inserted
replaced
925 } |
925 } |
926 |
926 |
927 static int nt_init(indexObject *self) |
927 static int nt_init(indexObject *self) |
928 { |
928 { |
929 if (self->nt == NULL) { |
929 if (self->nt == NULL) { |
|
930 if (self->raw_length > INT_MAX) { |
|
931 PyErr_SetString(PyExc_ValueError, "overflow in nt_init"); |
|
932 return -1; |
|
933 } |
930 self->ntcapacity = self->raw_length < 4 |
934 self->ntcapacity = self->raw_length < 4 |
931 ? 4 : self->raw_length / 2; |
935 ? 4 : (int)self->raw_length / 2; |
|
936 |
932 self->nt = calloc(self->ntcapacity, sizeof(nodetree)); |
937 self->nt = calloc(self->ntcapacity, sizeof(nodetree)); |
933 if (self->nt == NULL) { |
938 if (self->nt == NULL) { |
934 PyErr_NoMemory(); |
939 PyErr_NoMemory(); |
935 return -1; |
940 return -1; |
936 } |
941 } |