Mercurial > hg
changeset 38944:c1de67691d5b
index: move index_clearcaches() further down
I want to add a call from it to a new function (nt_dealloc) that will
be inserted below its current position.
Differential Revision: https://phab.mercurial-scm.org/D4117
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 19 Jul 2018 23:15:21 -0700 |
parents | 2b89e20c450c |
children | 0dce1297dd01 |
files | mercurial/cext/revlog.c |
diffstat | 1 files changed, 30 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cext/revlog.c Thu Jul 19 11:08:30 2018 -0700 +++ b/mercurial/cext/revlog.c Thu Jul 19 23:15:21 2018 -0700 @@ -310,36 +310,6 @@ Py_RETURN_NONE; } -static void _index_clearcaches(indexObject *self) -{ - if (self->cache) { - Py_ssize_t i; - - for (i = 0; i < self->raw_length; i++) - Py_CLEAR(self->cache[i]); - free(self->cache); - self->cache = NULL; - } - if (self->offsets) { - PyMem_Free(self->offsets); - self->offsets = NULL; - } - if (self->nt != NULL) { - free(self->nt->nodes); - PyMem_Free(self->nt); - } - self->nt = NULL; - Py_CLEAR(self->headrevs); -} - -static PyObject *index_clearcaches(indexObject *self) -{ - _index_clearcaches(self); - self->ntrev = -1; - self->ntlookups = self->ntmisses = 0; - Py_RETURN_NONE; -} - static PyObject *index_stats(indexObject *self) { PyObject *obj = PyDict_New(); @@ -2025,6 +1995,36 @@ return (PyObject *)self; } +static void _index_clearcaches(indexObject *self) +{ + if (self->cache) { + Py_ssize_t i; + + for (i = 0; i < self->raw_length; i++) + Py_CLEAR(self->cache[i]); + free(self->cache); + self->cache = NULL; + } + if (self->offsets) { + PyMem_Free(self->offsets); + self->offsets = NULL; + } + if (self->nt != NULL) { + free(self->nt->nodes); + PyMem_Free(self->nt); + } + self->nt = NULL; + Py_CLEAR(self->headrevs); +} + +static PyObject *index_clearcaches(indexObject *self) +{ + _index_clearcaches(self); + self->ntrev = -1; + self->ntlookups = self->ntmisses = 0; + Py_RETURN_NONE; +} + static void index_dealloc(indexObject *self) { _index_clearcaches(self);