[asterisk-commits] rmudgett: trunk r398499 - in /trunk: ./ main/astobj2.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 5 16:48:03 CDT 2013


Author: rmudgett
Date: Thu Sep  5 16:48:02 2013
New Revision: 398499

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=398499
Log:
astobj2: Only define ao2_bt() once.

* Make ao2_bt() not use single char variable names.

* Fix ao2_bt() formatting.
........

Merged revisions 398498 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/main/astobj2.c

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Thu Sep  5 16:48:02 2013
@@ -1,1 +1,1 @@
-/branches/12:1-398198,398206,398215,398226,398237,398283,398286,398299,398303,398368,398381,398418,398458
+/branches/12:1-398198,398206,398215,398226,398237,398283,398286,398299,398303,398368,398381,398418,398458,398498

Modified: trunk/main/astobj2.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/astobj2.c?view=diff&rev=398499&r1=398498&r2=398499
==============================================================================
--- trunk/main/astobj2.c (original)
+++ trunk/main/astobj2.c Thu Sep  5 16:48:02 2013
@@ -114,27 +114,28 @@
 static struct ao2_stats ao2;
 #endif
 
-#ifndef HAVE_BKTR	/* backtrace support */
-void ao2_bt(void) {}
-#else
+#ifdef HAVE_BKTR
 #include <execinfo.h>    /* for backtrace */
+#endif
 
 void ao2_bt(void)
 {
-	int c, i;
+#ifdef HAVE_BKTR
+	int depth;
+	int idx;
 #define N1	20
 	void *addresses[N1];
 	char **strings;
 
-	c = backtrace(addresses, N1);
-	strings = ast_bt_get_symbols(addresses,c);
-	ast_verbose("backtrace returned: %d\n", c);
-	for(i = 0; i < c; i++) {
-		ast_verbose("%d: %p %s\n", i, addresses[i], strings[i]);
+	depth = backtrace(addresses, N1);
+	strings = ast_bt_get_symbols(addresses, depth);
+	ast_verbose("backtrace returned: %d\n", depth);
+	for (idx = 0; idx < depth; ++idx) {
+		ast_verbose("%d: %p %s\n", idx, addresses[idx], strings[idx]);
 	}
 	ast_std_free(strings);
-}
 #endif
+}
 
 #define INTERNAL_OBJ_MUTEX(user_data) \
 	((struct astobj2_lock *) (((char *) (user_data)) - sizeof(struct astobj2_lock)))




More information about the asterisk-commits mailing list