From 82336715337c85a4fd00e96629178a877d96cd78 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Thu, 4 Jan 2007 22:51:01 +0000 Subject: add support for tracking thread-local-storage objects that exist via 'threadstorage' CLI commands git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@49553 f38db490-d61c-443f-a65b-d21fe96a405b --- main/utils.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'main/utils.c') diff --git a/main/utils.c b/main/utils.c index ff226fc11..88bd23c19 100644 --- a/main/utils.c +++ b/main/utils.c @@ -962,6 +962,9 @@ int ast_dynamic_str_thread_build_va(struct ast_dynamic_str **buf, size_t max_len { int res; int offset = (append && (*buf)->len) ? strlen((*buf)->str) : 0; +#if defined(DEBUG_THREADLOCALS) + struct ast_dynamic_str *old_buf = *buf; +#endif /* defined(DEBUG_THREADLOCALS) */ res = vsnprintf((*buf)->str + offset, (*buf)->len - offset, fmt, ap); @@ -984,8 +987,12 @@ int ast_dynamic_str_thread_build_va(struct ast_dynamic_str **buf, size_t max_len if (append) (*buf)->str[offset] = '\0'; - if (ts) + if (ts) { pthread_setspecific(ts->key, *buf); +#if defined(DEBUG_THREADLOCALS) + __ast_threadstorage_object_replace(old_buf, *buf, (*buf)->len + sizeof(*(*buf))); +#endif /* defined(DEBUG_THREADLOCALS) */ + } /* va_end() and va_start() must be done before calling * vsnprintf() again. */ -- cgit v1.2.3