mercurial/parsers.c
changeset 26775 3c259710737c
parent 26774 04ab2348efd1
child 26872 ce03e72837c6
equal deleted inserted replaced
26774:04ab2348efd1 26775:3c259710737c
  1575 }
  1575 }
  1576 
  1576 
  1577 static int nt_init(indexObject *self)
  1577 static int nt_init(indexObject *self)
  1578 {
  1578 {
  1579 	if (self->nt == NULL) {
  1579 	if (self->nt == NULL) {
  1580 		if (self->raw_length > INT_MAX / sizeof(nodetree)) {
  1580 		if ((size_t)self->raw_length > INT_MAX / sizeof(nodetree)) {
  1581 			PyErr_SetString(PyExc_ValueError, "overflow in nt_init");
  1581 			PyErr_SetString(PyExc_ValueError, "overflow in nt_init");
  1582 			return -1;
  1582 			return -1;
  1583 		}
  1583 		}
  1584 		self->ntcapacity = self->raw_length < 4
  1584 		self->ntcapacity = self->raw_length < 4
  1585 			? 4 : (int)self->raw_length / 2;
  1585 			? 4 : (int)self->raw_length / 2;