[PATCH 1 of 5] cext: fix compilation failure in revlog on Windows

Matt Harbison mharbison72 at gmail.com
Fri Aug 10 05:01:15 UTC 2018


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1533872514 14400
#      Thu Aug 09 23:41:54 2018 -0400
# Node ID 36b8875f1f317742e3914b1dacde6af73a15a045
# Parent  751caa6a293664aa0296ab52f634872442f2bb5c
cext: fix compilation failure in revlog on Windows

diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -1139,6 +1139,8 @@ static int nt_shortest(nodetree *self, c
 static int index_init_nt(indexObject *self)
 {
 	if (self->nt == NULL) {
+		unsigned capacity;
+
 		if ((size_t)self->raw_length > INT_MAX / sizeof(nodetreenode)) {
 			PyErr_SetString(PyExc_ValueError, "overflow in index_init_nt");
 			return -1;
@@ -1148,7 +1150,7 @@ static int index_init_nt(indexObject *se
 			PyErr_NoMemory();
 			return -1;
 		}
-		unsigned capacity = (self->raw_length < 4 ? 4 : (int)self->raw_length / 2);
+		capacity = (self->raw_length < 4 ? 4 : (int)self->raw_length / 2);
 		if (nt_init(self->nt, self, capacity) == -1) {
 			PyMem_Free(self->nt);
 			self->nt = NULL;


More information about the Mercurial-devel mailing list