diff --git a/mercurial/parsers.c b/mercurial/parsers.c --- a/mercurial/parsers.c +++ b/mercurial/parsers.c @@ -471,12 +471,8 @@ static void _index_clearcaches(indexObje if (self->cache) { Py_ssize_t i; - for (i = 0; i < self->raw_length; i++) { - if (self->cache[i]) { - Py_DECREF(self->cache[i]); - self->cache[i] = NULL; - } - } + for (i = 0; i < self->raw_length; i++) + Py_CLEAR(self->cache[i]); free(self->cache); self->cache = NULL; } @@ -922,10 +918,8 @@ static void nt_invalidate_added(indexObj nt_insert(self, PyString_AS_STRING(node), -1); } - if (start == 0) { - Py_DECREF(self->added); - self->added = NULL; - } + if (start == 0) + Py_CLEAR(self->added); } /*