Use va_copy for stringfields

The ast_string_field_build_va functions were written to take to separate
va_lists to work around FreeBSD 4 not having va_copy defined.

In the end, we don't support anything using gcc < 3 anyway because we use
va_copy all over the place anyway. This patch just simplifies things by
removing the second va_list function arguments in favor of va_copy.

Review: https://reviewboard.asterisk.org/r/1233/
--This line, and those below, will be ignored--

M    include/asterisk/stringfields.h
M    main/utils.c
M    main/channel.c


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@320946 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Terry Wilson
2011-05-26 15:55:22 +00:00
parent dbfac9cb55
commit fc8d4e823c
3 changed files with 26 additions and 32 deletions

View File

@@ -205,7 +205,7 @@ void __ast_string_field_ptr_build(struct ast_string_field_mgr *mgr,
*/
void __ast_string_field_ptr_build_va(struct ast_string_field_mgr *mgr,
struct ast_string_field_pool **pool_head,
ast_string_field *ptr, const char *format, va_list a1, va_list a2) __attribute__((format(printf, 4, 0)));
ast_string_field *ptr, const char *format, va_list ap) __attribute__((format(printf, 4, 0)));
/*!
\brief Declare a string field
@@ -369,8 +369,8 @@ typedef uint16_t ast_string_field_allocation;
\param args2 a second copy of the va_list for the sake of bsd, with no va_list copy operation
\return nothing
*/
#define ast_string_field_ptr_build_va(x, ptr, fmt, args1, args2) \
__ast_string_field_ptr_build_va(&(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) ptr, fmt, args1, args2)
#define ast_string_field_ptr_build_va(x, ptr, fmt, args) \
__ast_string_field_ptr_build_va(&(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) ptr, fmt, args)
/*!
\brief Set a field to a complex (built) value
@@ -381,7 +381,7 @@ typedef uint16_t ast_string_field_allocation;
\param args2 argument two
\return nothing
*/
#define ast_string_field_build_va(x, field, fmt, args1, args2) \
__ast_string_field_ptr_build_va(&(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) &(x)->field, fmt, args1, args2)
#define ast_string_field_build_va(x, field, fmt, args) \
__ast_string_field_ptr_build_va(&(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) &(x)->field, fmt, args)
#endif /* _ASTERISK_STRINGFIELDS_H */