Patchwork D4117: index: move index_clearcaches() further down

login
register
mail settings
Submitter phabricator
Date Aug. 7, 2018, 6:27 a.m.
Message ID <4d61022cdb4ec7174d1beac8a9119d91@localhost.localdomain>
Download mbox | patch
Permalink /patch/33386/
State Not Applicable
Headers show

Comments

phabricator - Aug. 7, 2018, 6:27 a.m.
martinvonz updated this revision to Diff 10041.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4117?vs=9982&id=10041

REVISION DETAIL
  https://phab.mercurial-scm.org/D4117

AFFECTED FILES
  mercurial/cext/revlog.c

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -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);