aboutsummaryrefslogtreecommitdiffstats
path: root/main/utils.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-04 22:51:01 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-04 22:51:01 +0000
commit82336715337c85a4fd00e96629178a877d96cd78 (patch)
tree29a8dc9130bff55092c8750d3e95dbdd1bd4af10 /main/utils.c
parent2623aa17b8f2f92cd5be0bac36639dc3f1d22434 (diff)
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
Diffstat (limited to 'main/utils.c')
-rw-r--r--main/utils.c9
1 files changed, 8 insertions, 1 deletions
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. */