# HG changeset patch # User Boris Feld # Date 1544804562 -3600 # Node ID 43974cd4496798fd21de45c984469546ed515046 # Parent d097dd0afc19942056971f0970449342749e73c9 revlog: introduce a constant for nullrev in `revlog.c` The value is important enough to be explicitly tracked. diff -r d097dd0afc19 -r 43974cd44967 mercurial/cext/revlog.c --- a/mercurial/cext/revlog.c Fri Nov 30 00:46:55 2018 +0100 +++ b/mercurial/cext/revlog.c Fri Dec 14 17:22:42 2018 +0100 @@ -98,6 +98,7 @@ static PyObject *nullentry = NULL; static const char nullid[20] = {0}; +static const Py_ssize_t nullrev = -1; static Py_ssize_t inline_scan(indexObject *self, const char **offsets); @@ -308,7 +309,7 @@ Py_ssize_t length = index_length(self); PyObject *entry; - if (pos == -1) { + if (pos == nullrev) { Py_INCREF(nullentry); return nullentry; } @@ -378,7 +379,7 @@ Py_ssize_t length = index_length(self); const char *data; - if (pos == -1) + if (pos == nullrev) return nullid; if (pos >= length) @@ -701,7 +702,7 @@ } /* Add its parents to the list of nodes to visit */ - if (revnum == -1) + if (revnum == nullrev) continue; r = index_get_parents(self, revnum, parents, (int)len - 1); if (r < 0)