mercurial/parsers.c
branchstable
changeset 16641 e6dfbc5df76f
parent 16604 48e42f984074
child 16642 5cf18921bb7b
child 16679 2950d186a927
--- a/mercurial/parsers.c	Wed May 09 18:45:14 2012 +0200
+++ b/mercurial/parsers.c	Tue May 08 14:46:04 2012 -0700
@@ -546,7 +546,7 @@
 
 static int nt_find(indexObject *self, const char *node, Py_ssize_t nodelen)
 {
-	int level, off;
+	int level, maxlevel, off;
 
 	if (nodelen == 20 && node[0] == '\0' && memcmp(node, nullid, 20) == 0)
 		return -1;
@@ -554,7 +554,9 @@
 	if (self->nt == NULL)
 		return -2;
 
-	for (level = off = 0; level < nodelen; level++) {
+	maxlevel = nodelen > 20 ? 40 : ((int)nodelen * 2);
+
+	for (level = off = 0; level < maxlevel; level++) {
 		int k = nt_level(node, level);
 		nodetree *n = &self->nt[off];
 		int v = n->children[k];
@@ -596,7 +598,7 @@
 	int level = 0;
 	int off = 0;
 
-	while (level < 20) {
+	while (level < 40) {
 		int k = nt_level(node, level);
 		nodetree *n;
 		int v;