[svn-commits] russell: branch russell/ast_verbose_threadstorage r38391 - in /team/russell/a...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu Jul 27 16:39:52 MST 2006


Author: russell
Date: Thu Jul 27 18:39:52 2006
New Revision: 38391

URL: http://svn.digium.com/view/asterisk?rev=38391&view=rev
Log:
move all of the declarations of FREE that is used to pass a function pointer
to free as an argument to a function to utils.h instead of declaring it locally
in all of the files where it is used

Modified:
    team/russell/ast_verbose_threadstorage/channel.c
    team/russell/ast_verbose_threadstorage/channels/chan_iax2.c
    team/russell/ast_verbose_threadstorage/channels/chan_sip.c
    team/russell/ast_verbose_threadstorage/cli.c
    team/russell/ast_verbose_threadstorage/include/asterisk/utils.h
    team/russell/ast_verbose_threadstorage/logger.c
    team/russell/ast_verbose_threadstorage/pbx/pbx_ael.c
    team/russell/ast_verbose_threadstorage/pbx/pbx_config.c
    team/russell/ast_verbose_threadstorage/res/res_features.c
    team/russell/ast_verbose_threadstorage/utils.c

Modified: team/russell/ast_verbose_threadstorage/channel.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_verbose_threadstorage/channel.c?rev=38391&r1=38390&r2=38391&view=diff
==============================================================================
--- team/russell/ast_verbose_threadstorage/channel.c (original)
+++ team/russell/ast_verbose_threadstorage/channel.c Thu Jul 27 18:39:52 2006
@@ -159,15 +159,6 @@
 	{ AST_CAUSE_PROTOCOL_ERROR, "PROTOCOL_ERROR", "Protocol error, unspecified" },
 	{ AST_CAUSE_INTERWORKING, "INTERWORKING", "Interworking, unspecified" },
 };
-
-#ifdef __AST_DEBUG_MALLOC
-static void FREE(void *ptr)
-{
-	free(ptr);
-}
-#else
-#define FREE free
-#endif
 
 struct ast_variable *ast_channeltype_list(void)
 {

Modified: team/russell/ast_verbose_threadstorage/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_verbose_threadstorage/channels/chan_iax2.c?rev=38391&r1=38390&r2=38391&view=diff
==============================================================================
--- team/russell/ast_verbose_threadstorage/channels/chan_iax2.c (original)
+++ team/russell/ast_verbose_threadstorage/channels/chan_iax2.c Thu Jul 27 18:39:52 2006
@@ -701,15 +701,6 @@
 static AST_LIST_HEAD_STATIC(dynamic_list, iax2_thread);
 
 static void *iax2_process_thread(void *data);
-
-#ifdef __AST_DEBUG_MALLOC
-static void FREE(void *ptr)
-{
-	free(ptr);
-}
-#else
-#define FREE free
-#endif
 
 static void signal_condition(ast_mutex_t *lock, ast_cond_t *cond)
 {

Modified: team/russell/ast_verbose_threadstorage/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_verbose_threadstorage/channels/chan_sip.c?rev=38391&r1=38390&r2=38391&view=diff
==============================================================================
--- team/russell/ast_verbose_threadstorage/channels/chan_sip.c (original)
+++ team/russell/ast_verbose_threadstorage/channels/chan_sip.c Thu Jul 27 18:39:52 2006
@@ -1536,15 +1536,6 @@
 	get_udptl_info: sip_get_udptl_peer,
 	set_udptl_peer: sip_set_udptl_peer,
 };
-
-#ifdef __AST_DEBUG_MALLOC
-static void FREE(void *ptr)
-{
-	free(ptr);
-}
-#else
-#define FREE free
-#endif
 
 /*! \brief Convert transfer status to string */
 static char *referstatus2str(enum referstatus rstatus)

Modified: team/russell/ast_verbose_threadstorage/cli.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_verbose_threadstorage/cli.c?rev=38391&r1=38390&r2=38391&view=diff
==============================================================================
--- team/russell/ast_verbose_threadstorage/cli.c (original)
+++ team/russell/ast_verbose_threadstorage/cli.c Thu Jul 27 18:39:52 2006
@@ -56,15 +56,6 @@
 
 /*! \brief Initial buffer size for resulting strings in ast_cli() */
 #define AST_CLI_MAXSTRLEN   256
-
-#ifdef __AST_DEBUG_MALLOC
-static void FREE(void *ptr)
-{
-	free(ptr);
-}
-#else
-#define FREE free
-#endif
 
 static void ast_cli_buf_key_create(void)
 {

Modified: team/russell/ast_verbose_threadstorage/include/asterisk/utils.h
URL: http://svn.digium.com/view/asterisk/team/russell/ast_verbose_threadstorage/include/asterisk/utils.h?rev=38391&r1=38390&r2=38391&view=diff
==============================================================================
--- team/russell/ast_verbose_threadstorage/include/asterisk/utils.h (original)
+++ team/russell/ast_verbose_threadstorage/include/asterisk/utils.h Thu Jul 27 18:39:52 2006
@@ -272,6 +272,21 @@
 long int ast_random(void);
 #endif
 
+/*! 
+ * \brief free() wrapper
+ *
+ * FREE should be used when a function pointer for free() needs to be passed
+ * as the argument to an application. Otherwise, astmm will cause seg faults.
+ */
+#ifdef __AST_DEBUG_MALLOC
+static void __attribute__ ((unused)) FREE(void *ptr) 
+{
+	free(ptr);
+}
+#else
+#define FREE free
+#endif
+
 #ifndef __AST_DEBUG_MALLOC
 
 /*!

Modified: team/russell/ast_verbose_threadstorage/logger.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_verbose_threadstorage/logger.c?rev=38391&r1=38390&r2=38391&view=diff
==============================================================================
--- team/russell/ast_verbose_threadstorage/logger.c (original)
+++ team/russell/ast_verbose_threadstorage/logger.c Thu Jul 27 18:39:52 2006
@@ -140,15 +140,6 @@
 static pthread_key_t verbose_buf_key;
 
 #define VERBOSE_BUF_INIT_SIZE	128
-
-#ifdef __AST_DEBUG_MALLOC
-static void FREE(void *ptr)
-{
-	free(ptr);
-}
-#else
-#define FREE free
-#endif
 
 static int make_components(char *s, int lineno)
 {

Modified: team/russell/ast_verbose_threadstorage/pbx/pbx_ael.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_verbose_threadstorage/pbx/pbx_ael.c?rev=38391&r1=38390&r2=38391&view=diff
==============================================================================
--- team/russell/ast_verbose_threadstorage/pbx/pbx_ael.c (original)
+++ team/russell/ast_verbose_threadstorage/pbx/pbx_ael.c Thu Jul 27 18:39:52 2006
@@ -50,16 +50,6 @@
 static char expr_output[2096];
 
 /* these functions are in ../ast_expr2.fl */
-
-	
-#ifdef __AST_DEBUG_MALLOC
-static void FREE(void *ptr)
-{
-	free(ptr);
-}
-#else
-#define FREE free
-#endif
 
 #define DEBUG_READ   (1 << 0)
 #define DEBUG_TOKENS (1 << 1)

Modified: team/russell/ast_verbose_threadstorage/pbx/pbx_config.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_verbose_threadstorage/pbx/pbx_config.c?rev=38391&r1=38390&r2=38391&view=diff
==============================================================================
--- team/russell/ast_verbose_threadstorage/pbx/pbx_config.c (original)
+++ team/russell/ast_verbose_threadstorage/pbx/pbx_config.c Thu Jul 27 18:39:52 2006
@@ -41,15 +41,6 @@
 #include "asterisk/logger.h"
 #include "asterisk/cli.h"
 #include "asterisk/callerid.h"
-
-#ifdef __AST_DEBUG_MALLOC
-static void FREE(void *ptr)
-{
-	free(ptr);
-}
-#else
-#define FREE free
-#endif
 
 static char *config = "extensions.conf";
 static char *registrar = "pbx_config";

Modified: team/russell/ast_verbose_threadstorage/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_verbose_threadstorage/res/res_features.c?rev=38391&r1=38390&r2=38391&view=diff
==============================================================================
--- team/russell/ast_verbose_threadstorage/res/res_features.c (original)
+++ team/russell/ast_verbose_threadstorage/res/res_features.c Thu Jul 27 18:39:52 2006
@@ -58,15 +58,6 @@
 #include "asterisk/adsi.h"
 #include "asterisk/devicestate.h"
 #include "asterisk/monitor.h"
-
-#ifdef __AST_DEBUG_MALLOC
-static void FREE(void *ptr)
-{
-	free(ptr);
-}
-#else
-#define FREE free
-#endif
 
 #define DEFAULT_PARK_TIME 45000
 #define DEFAULT_TRANSFER_DIGIT_TIMEOUT 3000

Modified: team/russell/ast_verbose_threadstorage/utils.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_verbose_threadstorage/utils.c?rev=38391&r1=38390&r2=38391&view=diff
==============================================================================
--- team/russell/ast_verbose_threadstorage/utils.c (original)
+++ team/russell/ast_verbose_threadstorage/utils.c Thu Jul 27 18:39:52 2006
@@ -64,15 +64,6 @@
 
 static pthread_key_t inet_ntoa_buf_key;
 static pthread_once_t inet_ntoa_buf_once = PTHREAD_ONCE_INIT;
-
-#ifdef __AST_DEBUG_MALLOC
-static void FREE(void *ptr)
-{
-	free(ptr);
-}
-#else
-#define FREE free
-#endif
 
 #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined( __NetBSD__ ) || defined(__APPLE__) || defined(__CYGWIN__)
 



More information about the svn-commits mailing list