Merged revisions 157639 via svnmerge from

https://origsvn.digium.com/svn/asterisk/trunk

........
  r157639 | tilghman | 2008-11-18 19:02:45 -0600 (Tue, 18 Nov 2008) | 7 lines
  
  Starting with a change to ensure that ast_verbose() preserves ABI compatibility
  in 1.6.1 (as compared to 1.6.0 and versions of 1.4), this change also
  deprecates the use of Asterisk with FreeBSD 4, given the central use of va_copy
  in core functions.  va_copy() is C99, anyway, and we already require C99 for
  other purposes, so this isn't really a big change anyway.  This change also
  simplifies some of the core ast_str_* functions.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@157641 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2008-11-19 01:08:46 +00:00
parent 78b55553fd
commit f21824e65a
4 changed files with 106 additions and 92 deletions

View File

@@ -1232,12 +1232,11 @@ void ast_backtrace(void)
#endif
}
void __ast_verbose(const char *file, int line, const char *func, const char *fmt, ...)
void __ast_verbose_ap(const char *file, int line, const char *func, const char *fmt, va_list ap)
{
struct logmsg *logmsg = NULL;
struct ast_str *buf = NULL;
int res = 0;
va_list ap;
if (!(buf = ast_str_thread_get(&verbose_buf, VERBOSE_BUF_INIT_SIZE)))
return;
@@ -1261,9 +1260,7 @@ void __ast_verbose(const char *file, int line, const char *func, const char *fmt
}
/* Build string */
va_start(ap, fmt);
res = ast_str_set_va(&buf, 0, fmt, ap);
va_end(ap);
/* If the build failed then we can drop this allocated message */
if (res == AST_DYNSTR_BUILD_FAILED)
@@ -1291,6 +1288,25 @@ void __ast_verbose(const char *file, int line, const char *func, const char *fmt
}
}
void __ast_verbose(const char *file, int line, const char *func, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
__ast_verbose_ap(file, line, func, fmt, ap);
va_end(ap);
}
/* No new code should use this directly, but we have the ABI for backwards compat */
#undef ast_verbose
void ast_verbose(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
void ast_verbose(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
__ast_verbose_ap("", 0, "", fmt, ap);
va_end(ap);
}
int ast_register_verbose(void (*v)(const char *string))
{
struct verb *verb;