summaryrefslogtreecommitdiff
path: root/include/asterisk/threadstorage.h
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2015-04-17 17:19:24 -0400
committerCorey Farrell <git@cfware.com>2015-04-17 16:30:13 -0500
commitc1d44ff0430dda6241effc775a84c9434e2fc1ba (patch)
tree325bcf18c230bbcefd93ad1e45a0a5b35bd1824f /include/asterisk/threadstorage.h
parent8435a0cdff848f77ff55e709a393ea96635e5b19 (diff)
Fix issue with AST_THREADSTORAGE_RAW when DEBUG_THREADLOCALS is enabled.
When DEBUG_THREADLOCALS is enabled it causes the threadlocal cleanup to be called as a function. This causes a compile error with raw threadstorage as it uses NULL for cleanup. This fix uses a macro that provides NULL when DEBUG_THREADLOCALS is disabled, and replaces the call to "c_cleanup(data);" with "{};" when DEBUG_THREADLOCALS is enabled. ASTERISK-24975 #close Reported by: Ashley Sanders Change-Id: I3ef7428ee402816d9fcefa1b3b95830c00d5c402
Diffstat (limited to 'include/asterisk/threadstorage.h')
-rw-r--r--include/asterisk/threadstorage.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/asterisk/threadstorage.h b/include/asterisk/threadstorage.h
index 4d587a5c7..4e61f42d2 100644
--- a/include/asterisk/threadstorage.h
+++ b/include/asterisk/threadstorage.h
@@ -64,6 +64,9 @@ struct ast_threadstorage {
void __ast_threadstorage_object_add(void *key, size_t len, const char *file, const char *function, unsigned int line);
void __ast_threadstorage_object_remove(void *key);
void __ast_threadstorage_object_replace(void *key_old, void *key_new, size_t len);
+#define THREADSTORAGE_RAW_CLEANUP(v) {}
+#else
+#define THREADSTORAGE_RAW_CLEANUP NULL
#endif /* defined(DEBUG_THREADLOCALS) */
/*!
@@ -85,7 +88,7 @@ void __ast_threadstorage_object_replace(void *key_old, void *key_new, size_t len
#define AST_THREADSTORAGE_EXTERNAL(name) \
extern struct ast_threadstorage name
#define AST_THREADSTORAGE_RAW(name) \
- AST_THREADSTORAGE_CUSTOM_SCOPE(name, NULL, NULL,)
+ AST_THREADSTORAGE_CUSTOM_SCOPE(name, NULL, THREADSTORAGE_RAW_CLEANUP,)
/*!
* \brief Define a thread storage variable, with custom initialization and cleanup