[svn-commits] russell: branch russell/ast_verbose_threadstorage
r38414 - in /team/russell/a...
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Fri Jul 28 01:46:51 MST 2006
Author: russell
Date: Fri Jul 28 03:46:51 2006
New Revision: 38414
URL: http://svn.digium.com/view/asterisk?rev=38414&view=rev
Log:
move a common operation into the header file
Modified:
team/russell/ast_verbose_threadstorage/cli.c
team/russell/ast_verbose_threadstorage/include/asterisk/threadstorage.h
team/russell/ast_verbose_threadstorage/logger.c
Modified: team/russell/ast_verbose_threadstorage/cli.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_verbose_threadstorage/cli.c?rev=38414&r1=38413&r2=38414&view=diff
==============================================================================
--- team/russell/ast_verbose_threadstorage/cli.c (original)
+++ team/russell/ast_verbose_threadstorage/cli.c Fri Jul 28 03:46:51 2006
@@ -67,10 +67,7 @@
return;
va_start(ap, fmt);
- while ((res = ast_dynamic_str_threadbuild_va(&buf, 0, &ast_cli_buf, fmt, ap)) == AST_DYNSTR_BUILD_RETRY) {
- va_end(ap);
- va_start(ap, fmt);
- }
+ res = ast_dynamic_str_threadbuild_va(&buf, 0, &ast_cli_buf, fmt, ap);
va_end(ap);
if (res > 0)
Modified: team/russell/ast_verbose_threadstorage/include/asterisk/threadstorage.h
URL: http://svn.digium.com/view/asterisk/team/russell/ast_verbose_threadstorage/include/asterisk/threadstorage.h?rev=38414&r1=38413&r2=38414&view=diff
==============================================================================
--- team/russell/ast_verbose_threadstorage/include/asterisk/threadstorage.h (original)
+++ team/russell/ast_verbose_threadstorage/include/asterisk/threadstorage.h Fri Jul 28 03:46:51 2006
@@ -102,8 +102,19 @@
AST_DYNSTR_BUILD_RETRY = -2
};
+#define ast_dynamic_str_threadbuild_va(buf, max_len, ts, fmt, ap) \
+ ({ \
+ int __res; \
+ while ((__res = __ast_dynamic_str_threadbuild_va(buf, max_len, \
+ ts, fmt, ap)) == AST_DYNSTR_BUILD_RETRY) { \
+ va_end(ap); \
+ va_start(ap, fmt); \
+ } \
+ (__res); \
+ })
+
AST_INLINE_API(
-int ast_dynamic_str_threadbuild_va(struct ast_dynamic_str **buf, size_t max_len,
+int __ast_dynamic_str_threadbuild_va(struct ast_dynamic_str **buf, size_t max_len,
struct ast_threadstorage *ts, const char *fmt, va_list ap),
{
int res;
Modified: team/russell/ast_verbose_threadstorage/logger.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_verbose_threadstorage/logger.c?rev=38414&r1=38413&r2=38414&view=diff
==============================================================================
--- team/russell/ast_verbose_threadstorage/logger.c (original)
+++ team/russell/ast_verbose_threadstorage/logger.c Fri Jul 28 03:46:51 2006
@@ -753,10 +753,7 @@
ast_console_puts_mutable(buf->str);
va_start(ap, fmt);
- while ((res = ast_dynamic_str_threadbuild_va(&buf, BUFSIZ, &log_buf, fmt, ap)) == AST_DYNSTR_BUILD_RETRY) {
- va_end(ap);
- va_start(ap, fmt);
- }
+ res = ast_dynamic_str_threadbuild_va(&buf, BUFSIZ, &log_buf, fmt, ap);
va_end(ap);
if (res != AST_DYNSTR_BUILD_FAILED)
ast_console_puts_mutable(buf->str);
@@ -780,10 +777,7 @@
int res;
/* No error message, continue printing */
va_start(ap, fmt);
- while ((res = ast_dynamic_str_threadbuild_va(&buf, BUFSIZ, &log_buf, fmt, ap)) == AST_DYNSTR_BUILD_RETRY) {
- va_end(ap);
- va_start(ap, fmt);
- }
+ ast_dynamic_str_threadbuild_va(&buf, BUFSIZ, &log_buf, fmt, ap);
va_end(ap);
if (res != AST_DYNSTR_BUILD_FAILED) {
term_strip(buf->str, buf->str, buf->len);
@@ -801,10 +795,7 @@
if (level != __LOG_VERBOSE) {
int res;
va_start(ap, fmt);
- while ((res = ast_dynamic_str_threadbuild_va(&buf, BUFSIZ, &log_buf, fmt, ap)) == AST_DYNSTR_BUILD_RETRY) {
- va_end(ap);
- va_start(ap, fmt);
- }
+ res = ast_dynamic_str_threadbuild_va(&buf, BUFSIZ, &log_buf, fmt, ap);
va_end(ap);
if (res != AST_DYNSTR_BUILD_FAILED)
fputs(buf->str, stdout);
@@ -861,10 +852,7 @@
return;
va_start(ap, fmt);
- while ((res = ast_dynamic_str_threadbuild_va(&buf, 0, &verbose_buf, fmt, ap)) == AST_DYNSTR_BUILD_RETRY) {
- va_end(ap);
- va_start(ap, fmt);
- }
+ res = ast_dynamic_str_threadbuild_va(&buf, 0, &verbose_buf, fmt, ap);
va_end(ap);
if (res == AST_DYNSTR_BUILD_FAILED)
More information about the svn-commits
mailing list