diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2012-02-29 14:25:32 +0100 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2012-02-29 14:25:32 +0100 |
commit | 4cebd6be0902d7cf179444151a3265ca897c9c6a (patch) | |
tree | 1e06c6724637de666077579f5058ca349b9cd737 /Cython/Utility/ModuleSetupCode.c | |
parent | 74aaff61098a4bbc232bb5fc7dd46a77e09b81fd (diff) | |
download | cython-4cebd6be0902d7cf179444151a3265ca897c9c6a.tar.gz |
fixed unused function warning about __pyx_clear_code_object_cache() when cleanup code is not being generated
Diffstat (limited to 'Cython/Utility/ModuleSetupCode.c')
-rw-r--r-- | Cython/Utility/ModuleSetupCode.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c index 29fcb2bf0..8fe79d51f 100644 --- a/Cython/Utility/ModuleSetupCode.c +++ b/Cython/Utility/ModuleSetupCode.c @@ -238,7 +238,6 @@ struct __Pyx_CodeObjectCache { static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static void __pyx_clear_code_object_cache(void); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); @@ -246,22 +245,6 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); // Note that errors are simply ignored in the code below. // This is just a cache, if a lookup or insertion fails - so what? -static void __pyx_clear_code_object_cache(void) { - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - int count = __pyx_code_cache.count; - int i; - if (entries == NULL) { - return; - } - __pyx_code_cache.count = 0; - __pyx_code_cache.max_count = 0; - __pyx_code_cache.entries = NULL; - for (i=0; i<count; i++) { - Py_DECREF(entries[i].code_object); - } - PyMem_Free(entries); -} - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { @@ -343,6 +326,20 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { Py_INCREF(code_object); } +/////////////// CodeObjectCache.cleanup /////////////// + + if (__pyx_code_cache.entries) { + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + int i, count = __pyx_code_cache.count; + __pyx_code_cache.count = 0; + __pyx_code_cache.max_count = 0; + __pyx_code_cache.entries = NULL; + for (i=0; i<count; i++) { + Py_DECREF(entries[i].code_object); + } + PyMem_Free(entries); + } + /////////////// CheckBinaryVersion.proto /////////////// static int __Pyx_check_binary_version(void); |