[asterisk-commits] twilson: trunk r320946 - in /trunk: include/asterisk/ main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu May 26 10:55:29 CDT 2011
Author: twilson
Date: Thu May 26 10:55:22 2011
New Revision: 320946
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=320946
Log:
Merged revisions 320716 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
........
r320716 | twilson | 2011-05-24 17:49:10 -0700 (Tue, 24 May 2011) | 4 lines
Cast data as char * before using S_OR
This is required for compiling successfully under dev mode
........
Modified:
trunk/include/asterisk/stringfields.h
trunk/main/channel.c
trunk/main/utils.c
Modified: trunk/include/asterisk/stringfields.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/stringfields.h?view=diff&rev=320946&r1=320945&r2=320946
==============================================================================
--- trunk/include/asterisk/stringfields.h (original)
+++ trunk/include/asterisk/stringfields.h Thu May 26 10:55:22 2011
@@ -205,7 +205,7 @@
*/
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 @@
\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 @@
\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 */
Modified: trunk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/channel.c?view=diff&rev=320946&r1=320945&r2=320946
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Thu May 26 10:55:22 2011
@@ -1118,7 +1118,7 @@
__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 @@
* 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 @@
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 @@
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;
}
Modified: trunk/main/utils.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/utils.c?view=diff&rev=320946&r1=320945&r2=320946
==============================================================================
--- trunk/main/utils.c (original)
+++ trunk/main/utils.c Thu May 26 10:55:22 2011
@@ -1733,13 +1733,14 @@
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 ap1, va_list ap2)
+ ast_string_field *ptr, const char *format, va_list ap)
{
size_t needed;
size_t available;
size_t space = (*pool_head)->size - (*pool_head)->used;
ssize_t grow;
char *target;
+ va_list ap2;
/* if the field already has space allocated, try to reuse it;
otherwise, try to use the empty space at the end of the current
@@ -1762,9 +1763,9 @@
available = space - sizeof(ast_string_field_allocation);
}
- needed = vsnprintf(target, available, format, ap1) + 1;
-
- va_end(ap1);
+ va_copy(ap2, ap);
+ needed = vsnprintf(target, available, format, ap2) + 1;
+ va_end(ap2);
if (needed > available) {
/* the allocation could not be satisfied using the field's current allocation
@@ -1774,7 +1775,8 @@
if (!(target = (char *) __ast_string_field_alloc_space(mgr, pool_head, needed))) {
return;
}
- vsprintf(target, format, ap2);
+ vsprintf(target, format, ap);
+ va_end(ap);
__ast_string_field_release_active(*pool_head, *ptr);
*ptr = target;
} else if (*ptr != target) {
@@ -1800,15 +1802,11 @@
struct ast_string_field_pool **pool_head,
ast_string_field *ptr, const char *format, ...)
{
- va_list ap1, ap2;
-
- va_start(ap1, format);
- va_start(ap2, format); /* va_copy does not exist on FreeBSD */
-
- __ast_string_field_ptr_build_va(mgr, pool_head, ptr, format, ap1, ap2);
-
- va_end(ap1);
- va_end(ap2);
+ va_list ap;
+
+ va_start(ap, format);
+ __ast_string_field_ptr_build_va(mgr, pool_head, ptr, format, ap);
+ va_end(ap);
}
void *__ast_calloc_with_stringfields(unsigned int num_structs, size_t struct_size, size_t field_mgr_offset,
More information about the asterisk-commits
mailing list