Commit 4cebd6be authored by Stefan Behnel's avatar Stefan Behnel

fixed unused function warning about __pyx_clear_code_object_cache() when...

fixed unused function warning about __pyx_clear_code_object_cache() when cleanup code is not being generated
parent 74aaff61
......@@ -84,8 +84,12 @@ class UtilityCodeBase(object):
if type == 'Proto':
utility[0] = code
else:
elif type == 'Code':
utility[1] = code
else:
all_tags = utility[2]
all_tags[type.lower()] = code
if tags:
all_tags = utility[2]
for name, values in tags.items():
......@@ -138,6 +142,9 @@ class UtilityCodeBase(object):
if name.endswith(".proto"):
name = name[:-6]
type = 'Proto'
elif name.endswith(".cleanup"):
name = name[:-8]
type = 'cleanup'
else:
type = 'Code'
utility = utilities.setdefault(name, [None, None, {}])
......
......@@ -1899,7 +1899,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln("/*--- Code object cache cleanup code ---*/")
code.globalstate.use_utility_code(
UtilityCode.load_cached("CodeObjectCache", "ModuleSetupCode.c"))
code.putln('%s();' % Naming.global_code_object_cache_clear)
# for entry in env.pynum_entries:
# code.put_decref_clear(entry.cname,
# PyrexTypes.py_object_type,
......
......@@ -101,7 +101,6 @@ quick_temp_cname = pyrex_prefix + "temp" # temp variable for quick'n'dirty tempi
global_code_object_cache_find = pyrex_prefix + 'find_code_object'
global_code_object_cache_insert = pyrex_prefix + 'insert_code_object'
global_code_object_cache_clear = pyrex_prefix + 'clear_code_object_cache'
genexpr_id_ref = 'genexpr'
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment