Mercurial > hg-stable
changeset 40973:43974cd44967
revlog: introduce a constant for nullrev in `revlog.c`
The value is important enough to be explicitly tracked.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Fri, 14 Dec 2018 17:22:42 +0100 |
parents | d097dd0afc19 |
children | b54727f82511 |
files | mercurial/cext/revlog.c |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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)