[asterisk-commits] rmudgett: trunk r359904 - in /trunk: include/asterisk/app.h main/app.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Mar 16 15:37:58 CDT 2012
Author: rmudgett
Date: Fri Mar 16 15:37:54 2012
New Revision: 359904
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=359904
Log:
Simplify some code in ast_app_run_sub().
* Remove unnnecessary const from const char * const var declaration in the
ast_app_run_macro() and ast_app_run_sub() prototypes. The second const is
unnecessary.
Modified:
trunk/include/asterisk/app.h
trunk/main/app.c
Modified: trunk/include/asterisk/app.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/app.h?view=diff&rev=359904&r1=359903&r2=359904
==============================================================================
--- trunk/include/asterisk/app.h (original)
+++ trunk/include/asterisk/app.h Fri Mar 16 15:37:54 2012
@@ -131,8 +131,8 @@
* \retval 0 success
* \retval -1 failure
*/
-int ast_app_run_macro(struct ast_channel *autoservice_chan, struct ast_channel
- *macro_chan, const char * const macro_name, const char * const macro_args);
+int ast_app_run_macro(struct ast_channel *autoservice_chan,
+ struct ast_channel *macro_chan, const char *macro_name, const char *macro_args);
/*!
* \since 11
@@ -151,8 +151,8 @@
* \retval 0 success
* \retval -1 failure
*/
-int ast_app_run_sub(struct ast_channel *autoservice_chan, struct ast_channel
- *sub_chan, const char * const name, const char * const args);
+int ast_app_run_sub(struct ast_channel *autoservice_chan,
+ struct ast_channel *sub_chan, const char *name, const char *args);
/*!
* \brief Set voicemail function callbacks
Modified: trunk/main/app.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/app.c?view=diff&rev=359904&r1=359903&r2=359904
==============================================================================
--- trunk/main/app.c (original)
+++ trunk/main/app.c Fri Mar 16 15:37:54 2012
@@ -281,22 +281,24 @@
return res;
}
-int ast_app_run_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const char * const name, const char * const args)
+int ast_app_run_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const char *name, const char *args)
{
char buf[1024];
snprintf(buf, sizeof(buf), "%s%s%s", name, ast_strlen_zero(args) ? "" : ",", S_OR(args, ""));
return app_exec_dialplan(autoservice_chan, macro_chan, buf, 0);
}
-int ast_app_run_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const char * const location, const char * const args)
+int ast_app_run_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const char *location, const char *args)
{
char buf[1024];
size_t offset = snprintf(buf, sizeof(buf), "%s", location);
+
/* need to bump the priority by one if we already have a pbx */
if (ast_channel_pbx(sub_chan)) {
int iprio;
- const char * priority = location;
- const char * next = strchr(priority,',');
+ const char *priority = location;
+ const char *next = strchr(priority,',');
+
/* jump to the priority portion of the location */
if (next) {
priority = next + 1;
@@ -314,8 +316,8 @@
}
}
}
- if (offset < sizeof(buf)) {
- snprintf(buf + offset, sizeof(buf) - offset, "%s%s%s", ast_strlen_zero(args) ? "" : "(", S_OR(args, ""), ast_strlen_zero(args) ? "" : ")");
+ if (!ast_strlen_zero(args) && offset < sizeof(buf)) {
+ snprintf(buf + offset, sizeof(buf) - offset, "(%s)", args);
}
return app_exec_dialplan(autoservice_chan, sub_chan, buf, 1);
}
More information about the asterisk-commits
mailing list