diff options
author | Terry Wilson <twilson@digium.com> | 2011-05-26 15:55:22 +0000 |
---|---|---|
committer | Terry Wilson <twilson@digium.com> | 2011-05-26 15:55:22 +0000 |
commit | fc8d4e823c7e7baae92752572b3e0e1077f9e45f (patch) | |
tree | 3113209dbd76614eebdffcae85f2b7447aba7f32 /main/channel.c | |
parent | dbfac9cb55200f04871503fafbd689bece5a4293 (diff) |
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
Diffstat (limited to 'main/channel.c')
-rw-r--r-- | main/channel.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/main/channel.c b/main/channel.c index 0dc9c0ba3..f60635ebe 100644 --- a/main/channel.c +++ b/main/channel.c @@ -1118,7 +1118,7 @@ static struct ast_channel * attribute_malloc __attribute__((format(printf, 13, 0 __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char *cid_name, const char *acctcode, const char *exten, const char *context, const char *linkedid, const int amaflag, const char *file, int line, - const char *function, const char *name_fmt, va_list ap1, va_list ap2) + const char *function, const char *name_fmt, va_list ap) { struct ast_channel *tmp; int x; @@ -1263,7 +1263,7 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char * uses them to build the string, instead of forming the va_lists internally from the vararg ... list. * This new function was written so this can be accomplished. */ - ast_string_field_build_va(tmp, name, name_fmt, ap1, ap2); + ast_string_field_build_va(tmp, name, name_fmt, ap); tech = ast_strdupa(tmp->name); if ((slash = strchr(tech, '/'))) { if ((slash2 = strchr(slash + 1, '/'))) { @@ -1362,15 +1362,13 @@ struct ast_channel *__ast_channel_alloc(int needqueue, int state, const char *ci const char *file, int line, const char *function, const char *name_fmt, ...) { - va_list ap1, ap2; + va_list ap; struct ast_channel *result; - va_start(ap1, name_fmt); - va_start(ap2, name_fmt); + va_start(ap, name_fmt); result = __ast_channel_alloc_ap(needqueue, state, cid_num, cid_name, acctcode, exten, context, - linkedid, amaflag, file, line, function, name_fmt, ap1, ap2); - va_end(ap1); - va_end(ap2); + linkedid, amaflag, file, line, function, name_fmt, ap); + va_end(ap); return result; } @@ -9584,16 +9582,14 @@ struct ast_channel *ast_channel_alloc(int needqueue, int state, const char *cid_ const char *linkedid, const int amaflag, const char *name_fmt, ...) { - va_list ap1, ap2; + va_list ap; struct ast_channel *result; - va_start(ap1, name_fmt); - va_start(ap2, name_fmt); + va_start(ap, name_fmt); result = __ast_channel_alloc_ap(needqueue, state, cid_num, cid_name, acctcode, exten, context, - linkedid, amaflag, __FILE__, __LINE__, __FUNCTION__, name_fmt, ap1, ap2); - va_end(ap1); - va_end(ap2); + linkedid, amaflag, __FILE__, __LINE__, __FUNCTION__, name_fmt, ap); + va_end(ap); return result; } |