diff options
author | Richard Mudgett <rmudgett@digium.com> | 2013-09-05 21:48:02 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2013-09-05 21:48:02 +0000 |
commit | ccfad032e476ba077a4b49879f93db6154550101 (patch) | |
tree | 399fcd129cb3e7f5c08ae1de6824d932b5350fdb /main/astobj2.c | |
parent | 778d174126ad06b711dbfe9d5ddcbfbd31bf5b76 (diff) |
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
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@398499 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/astobj2.c')
-rw-r--r-- | main/astobj2.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/main/astobj2.c b/main/astobj2.c index cc6ab7348..5cb3ee3d5 100644 --- a/main/astobj2.c +++ b/main/astobj2.c @@ -114,27 +114,28 @@ struct ao2_stats { 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))) |