diff options
author | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-12-15 23:10:42 +0000 |
---|---|---|
committer | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-12-15 23:10:42 +0000 |
commit | b68b240ef802a54356a84c0264665fdaf838a80a (patch) | |
tree | 67a2fe73762b64d378d6a34cb489de4ff4492a60 /main/logger.c | |
parent | 5343b4f73dd0495d58bb77399d044ff586ef9638 (diff) |
simplify the ast_dynamic_str_*.... routines by
renaming them to ast_str ... and putting the
struct ast_threadstorage pointer into the struct ast_str.
This makes the code a lot more readable.
At this point we can use these routines also to
replace ast_build_string().
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48510 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/logger.c')
-rw-r--r-- | main/logger.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/main/logger.c b/main/logger.c index 660fb2f74..440c7dea2 100644 --- a/main/logger.c +++ b/main/logger.c @@ -695,14 +695,14 @@ static void ast_log_vsyslog(int level, const char *file, int line, const char *f void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) { struct logchannel *chan; - struct ast_dynamic_str *buf; + struct ast_str *buf; time_t t; struct tm tm; char date[256]; va_list ap; - if (!(buf = ast_dynamic_str_thread_get(&log_buf, LOG_BUF_INIT_SIZE))) + if (!(buf = ast_str_thread_get(&log_buf, LOG_BUF_INIT_SIZE))) return; if (AST_LIST_EMPTY(&logchannels)) @@ -714,7 +714,7 @@ void ast_log(int level, const char *file, int line, const char *function, const if (level != __LOG_VERBOSE) { int res; va_start(ap, fmt); - res = ast_dynamic_str_thread_set_va(&buf, BUFSIZ, &log_buf, fmt, ap); + res = ast_str_set_va(&buf, BUFSIZ, fmt, ap); /* XXX BUFSIZ ? */ va_end(ap); if (res != AST_DYNSTR_BUILD_FAILED) { term_filter_escapes(buf->str); @@ -775,7 +775,7 @@ void ast_log(int level, const char *file, int line, const char *function, const if (level != __LOG_VERBOSE) { int res; sprintf(linestr, "%d", line); - ast_dynamic_str_thread_set(&buf, BUFSIZ, &log_buf, + ast_str_set(&buf, BUFSIZ, "[%s] %s[%ld]: %s:%s %s: ", date, term_color(tmp1, levels[level], colors[level], 0, sizeof(tmp1)), @@ -788,7 +788,7 @@ void ast_log(int level, const char *file, int line, const char *function, const ast_console_puts_mutable(buf->str); va_start(ap, fmt); - res = ast_dynamic_str_thread_set_va(&buf, BUFSIZ, &log_buf, fmt, ap); + res = ast_str_set_va(&buf, BUFSIZ, fmt, ap); va_end(ap); if (res != AST_DYNSTR_BUILD_FAILED) ast_console_puts_mutable(buf->str); @@ -796,7 +796,7 @@ void ast_log(int level, const char *file, int line, const char *function, const /* File channels */ } else if ((chan->logmask & (1 << level)) && (chan->fileptr)) { int res; - ast_dynamic_str_thread_set(&buf, BUFSIZ, &log_buf, + ast_str_set(&buf, BUFSIZ, "[%s] %s[%ld] %s: ", date, levels[level], (long)GETTID(), file); res = fprintf(chan->fileptr, "%s", buf->str); @@ -812,7 +812,7 @@ void ast_log(int level, const char *file, int line, const char *function, const int res; /* No error message, continue printing */ va_start(ap, fmt); - res = ast_dynamic_str_thread_set_va(&buf, BUFSIZ, &log_buf, fmt, ap); + res = ast_str_set_va(&buf, BUFSIZ, fmt, ap); va_end(ap); if (res != AST_DYNSTR_BUILD_FAILED) { term_strip(buf->str, buf->str, buf->len); @@ -868,7 +868,7 @@ void ast_backtrace(void) void ast_verbose(const char *fmt, ...) { struct verb *v; - struct ast_dynamic_str *buf; + struct ast_str *buf; int res; va_list ap; @@ -886,11 +886,11 @@ void ast_verbose(const char *fmt, ...) fmt = datefmt; } - if (!(buf = ast_dynamic_str_thread_get(&verbose_buf, VERBOSE_BUF_INIT_SIZE))) + if (!(buf = ast_str_thread_get(&verbose_buf, VERBOSE_BUF_INIT_SIZE))) return; va_start(ap, fmt); - res = ast_dynamic_str_thread_set_va(&buf, 0, &verbose_buf, fmt, ap); + res = ast_str_set_va(&buf, 0, fmt, ap); va_end(ap); if (res == AST_DYNSTR_BUILD_FAILED) |