From b3cea0f20dc8cb01c01d8a578708725b2c605512 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Fri, 5 Sep 2008 19:12:20 +0000 Subject: [PATCH] (OPENZAP-12) fix param passing in ZIO_SIG_CONFIGURE_FUNCTION on some platforms git-svn-id: http://svn.openzap.org/svn/openzap/trunk@531 a93c3328-9c30-0410-af19-c9cd2b2d52af --- libs/openzap/src/include/zap_types.h | 2 +- libs/openzap/src/ozmod/ozmod_analog/ozmod_analog.c | 5 ++++- libs/openzap/src/ozmod/ozmod_isdn/ozmod_isdn.c | 3 +++ libs/openzap/src/ozmod/ozmod_ss7_boost/ozmod_ss7_boost.c | 3 +++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libs/openzap/src/include/zap_types.h b/libs/openzap/src/include/zap_types.h index 3c04b8db8d..ace40c8698 100644 --- a/libs/openzap/src/include/zap_types.h +++ b/libs/openzap/src/include/zap_types.h @@ -409,7 +409,7 @@ typedef struct zap_io_interface zap_io_interface_t; #define ZIO_IO_LOAD_ARGS (zap_io_interface_t **zio) #define ZIO_IO_UNLOAD_ARGS (void) #define ZIO_SIG_LOAD_ARGS (void) -#define ZIO_SIG_CONFIGURE_ARGS (zap_span_t *span, zio_signal_cb_t sig_cb, va_list ap) +#define ZIO_SIG_CONFIGURE_ARGS (zap_span_t *span, zio_signal_cb_t sig_cb, ...) #define ZIO_SIG_UNLOAD_ARGS (void) typedef zap_status_t (*zio_channel_request_t) ZIO_CHANNEL_REQUEST_ARGS ; diff --git a/libs/openzap/src/ozmod/ozmod_analog/ozmod_analog.c b/libs/openzap/src/ozmod/ozmod_analog/ozmod_analog.c index 6bf8b86977..c149f0cf7a 100644 --- a/libs/openzap/src/ozmod/ozmod_analog/ozmod_analog.c +++ b/libs/openzap/src/ozmod/ozmod_analog/ozmod_analog.c @@ -87,6 +87,7 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_analog_configure_span) uint32_t max_dialstr = 11; const char *var, *val; int *intval; + va_list ap; assert(sig_cb != NULL); @@ -104,9 +105,10 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_analog_configure_span) } analog_data = malloc(sizeof(*analog_data)); - memset(analog_data, 0, sizeof(*analog_data)); assert(analog_data != NULL); + memset(analog_data, 0, sizeof(*analog_data)); + va_start(ap, sig_cb); while ((var = va_arg(ap, char *))) { if (!strcasecmp(var, "tonemap")) { if (!(val = va_arg(ap, char *))) { @@ -125,6 +127,7 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_analog_configure_span) max_dialstr = *intval; } } + va_end(ap); span->start = zap_analog_start; analog_data->digit_timeout = digit_timeout; diff --git a/libs/openzap/src/ozmod/ozmod_isdn/ozmod_isdn.c b/libs/openzap/src/ozmod/ozmod_isdn/ozmod_isdn.c index 5e86199d89..73ef91f38f 100644 --- a/libs/openzap/src/ozmod/ozmod_isdn/ozmod_isdn.c +++ b/libs/openzap/src/ozmod/ozmod_isdn/ozmod_isdn.c @@ -1327,6 +1327,7 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_isdn_configure_span) char *var, *val; Q931Dialect_t dialect = Q931_Dialect_National; uint32_t opts = 0; + va_list ap; if (span->signal_type) { snprintf(span->last_error, sizeof(span->last_error), "Span is already configured for signalling [%d].", span->signal_type); @@ -1365,6 +1366,7 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_isdn_configure_span) isdn_data->mode = Q931_TE; dialect = Q931_Dialect_National; + va_start(ap, sig_cb); while((var = va_arg(ap, char *))) { if (!strcasecmp(var, "mode")) { if (!(val = va_arg(ap, char *))) { @@ -1387,6 +1389,7 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_isdn_configure_span) opts = isdn_data->opts = *optp; } } + va_end(ap); span->start = zap_isdn_start; isdn_data->sig_cb = sig_cb; diff --git a/libs/openzap/src/ozmod/ozmod_ss7_boost/ozmod_ss7_boost.c b/libs/openzap/src/ozmod/ozmod_ss7_boost/ozmod_ss7_boost.c index 7a3e08d2ce..a58781adc5 100644 --- a/libs/openzap/src/ozmod/ozmod_ss7_boost/ozmod_ss7_boost.c +++ b/libs/openzap/src/ozmod/ozmod_ss7_boost/ozmod_ss7_boost.c @@ -1095,7 +1095,9 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_ss7_boost_configure_span) int local_port = 5300, remote_port = 5300; char *var, *val; int *intval; + va_list ap; + va_start(ap, sig_cb); while((var = va_arg(ap, char *))) { if (!strcasecmp(var, "local_ip")) { if (!(val = va_arg(ap, char *))) { @@ -1119,6 +1121,7 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_ss7_boost_configure_span) remote_port = *intval; } } + va_end(ap); if (!local_ip && local_port && remote_ip && remote_port && sig_cb) {