[asterisk-commits] Fix issue with AST THREADSTORAGE RAW when DEBUG THREADLOCALS... (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 20 05:54:01 CDT 2015


Joshua Colp has submitted this change and it was merged.

Change subject: Fix issue with AST_THREADSTORAGE_RAW when DEBUG_THREADLOCALS is enabled.
......................................................................


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
---
M include/asterisk/threadstorage.h
1 file changed, 4 insertions(+), 1 deletion(-)

Approvals:
  Matt Jordan: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Verified



diff --git a/include/asterisk/threadstorage.h b/include/asterisk/threadstorage.h
index 4d587a5..4e61f42 100644
--- a/include/asterisk/threadstorage.h
+++ b/include/asterisk/threadstorage.h
@@ -64,6 +64,9 @@
 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 @@
 #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

-- 
To view, visit https://gerrit.asterisk.org/142
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3ef7428ee402816d9fcefa1b3b95830c00d5c402
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list