Show More
@@ -310,36 +310,6 b' static PyObject *index_append(indexObjec' | |||||
310 | Py_RETURN_NONE; |
|
310 | Py_RETURN_NONE; | |
311 | } |
|
311 | } | |
312 |
|
312 | |||
313 | static void _index_clearcaches(indexObject *self) |
|
|||
314 | { |
|
|||
315 | if (self->cache) { |
|
|||
316 | Py_ssize_t i; |
|
|||
317 |
|
||||
318 | for (i = 0; i < self->raw_length; i++) |
|
|||
319 | Py_CLEAR(self->cache[i]); |
|
|||
320 | free(self->cache); |
|
|||
321 | self->cache = NULL; |
|
|||
322 | } |
|
|||
323 | if (self->offsets) { |
|
|||
324 | PyMem_Free(self->offsets); |
|
|||
325 | self->offsets = NULL; |
|
|||
326 | } |
|
|||
327 | if (self->nt != NULL) { |
|
|||
328 | free(self->nt->nodes); |
|
|||
329 | PyMem_Free(self->nt); |
|
|||
330 | } |
|
|||
331 | self->nt = NULL; |
|
|||
332 | Py_CLEAR(self->headrevs); |
|
|||
333 | } |
|
|||
334 |
|
||||
335 | static PyObject *index_clearcaches(indexObject *self) |
|
|||
336 | { |
|
|||
337 | _index_clearcaches(self); |
|
|||
338 | self->ntrev = -1; |
|
|||
339 | self->ntlookups = self->ntmisses = 0; |
|
|||
340 | Py_RETURN_NONE; |
|
|||
341 | } |
|
|||
342 |
|
||||
343 | static PyObject *index_stats(indexObject *self) |
|
313 | static PyObject *index_stats(indexObject *self) | |
344 | { |
|
314 | { | |
345 | PyObject *obj = PyDict_New(); |
|
315 | PyObject *obj = PyDict_New(); | |
@@ -2025,6 +1995,36 b' static PyObject *index_nodemap(indexObje' | |||||
2025 | return (PyObject *)self; |
|
1995 | return (PyObject *)self; | |
2026 | } |
|
1996 | } | |
2027 |
|
1997 | |||
|
1998 | static void _index_clearcaches(indexObject *self) | |||
|
1999 | { | |||
|
2000 | if (self->cache) { | |||
|
2001 | Py_ssize_t i; | |||
|
2002 | ||||
|
2003 | for (i = 0; i < self->raw_length; i++) | |||
|
2004 | Py_CLEAR(self->cache[i]); | |||
|
2005 | free(self->cache); | |||
|
2006 | self->cache = NULL; | |||
|
2007 | } | |||
|
2008 | if (self->offsets) { | |||
|
2009 | PyMem_Free(self->offsets); | |||
|
2010 | self->offsets = NULL; | |||
|
2011 | } | |||
|
2012 | if (self->nt != NULL) { | |||
|
2013 | free(self->nt->nodes); | |||
|
2014 | PyMem_Free(self->nt); | |||
|
2015 | } | |||
|
2016 | self->nt = NULL; | |||
|
2017 | Py_CLEAR(self->headrevs); | |||
|
2018 | } | |||
|
2019 | ||||
|
2020 | static PyObject *index_clearcaches(indexObject *self) | |||
|
2021 | { | |||
|
2022 | _index_clearcaches(self); | |||
|
2023 | self->ntrev = -1; | |||
|
2024 | self->ntlookups = self->ntmisses = 0; | |||
|
2025 | Py_RETURN_NONE; | |||
|
2026 | } | |||
|
2027 | ||||
2028 | static void index_dealloc(indexObject *self) |
|
2028 | static void index_dealloc(indexObject *self) | |
2029 | { |
|
2029 | { | |
2030 | _index_clearcaches(self); |
|
2030 | _index_clearcaches(self); |
General Comments 0
You need to be logged in to leave comments.
Login now