[Asterisk-code-review] pbx.h: Make ast state cb type take more const. (asterisk[master])
Joshua Colp
asteriskteam at digium.com
Fri Apr 8 15:47:51 CDT 2016
Joshua Colp has submitted this change and it was merged.
Change subject: pbx.h: Make ast_state_cb_type take more const.
......................................................................
pbx.h: Make ast_state_cb_type take more const.
This eliminates some casts that I made a note saying v10 and above
would no longer need them.
Better late than never :)
Change-Id: I346cdb3032b6478ceb40eb6fe732978b54035572
---
M apps/app_queue.c
M channels/chan_sip.c
M channels/chan_skinny.c
M include/asterisk/pbx.h
M main/manager.c
M main/pbx.c
M res/res_pjsip_exten_state.c
7 files changed, 13 insertions(+), 13 deletions(-)
Approvals:
Joshua Colp: Looks good to me, approved; Verified
George Joseph: Looks good to me, but someone else must approve
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 776ada4..0123e47 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -2461,7 +2461,7 @@
return state;
}
-static int extension_state_cb(char *context, char *exten, struct ast_state_cb_info *info, void *data)
+static int extension_state_cb(const char *context, const char *exten, struct ast_state_cb_info *info, void *data)
{
struct ao2_iterator miter, qiter;
struct member *m;
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index ffc2084..2a6dd77 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1269,7 +1269,7 @@
/*--- Device monitoring and Device/extension state/event handling */
static int extensionstate_update(const char *context, const char *exten, struct state_notify_data *data, struct sip_pvt *p, int force);
-static int cb_extensionstate(char *context, char *exten, struct ast_state_cb_info *info, void *data);
+static int cb_extensionstate(const char *context, const char *exten, struct ast_state_cb_info *info, void *data);
static int sip_poke_noanswer(const void *data);
static int sip_poke_peer(struct sip_peer *peer, int force);
static void sip_poke_all_peers(void);
@@ -17389,7 +17389,7 @@
/*! \brief Callback for the devicestate notification (SUBSCRIBE) support subsystem
\note If you add an "hint" priority to the extension in the dial plan,
you will get notifications on device state changes */
-static int cb_extensionstate(char *context, char *exten, struct ast_state_cb_info *info, void *data)
+static int cb_extensionstate(const char *context, const char *exten, struct ast_state_cb_info *info, void *data)
{
struct sip_pvt *p = data;
struct state_notify_data notify_data = {
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index da156fc..76990d1 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -1671,7 +1671,7 @@
.send_digit_end = skinny_senddigit_end,
};
-static int skinny_extensionstate_cb(char *context, char *id, struct ast_state_cb_info *info, void *data);
+static int skinny_extensionstate_cb(const char *context, const char *exten, struct ast_state_cb_info *info, void *data);
static struct skinny_line *skinny_line_alloc(void)
{
@@ -3413,7 +3413,7 @@
transmit_response(d, req);
}
-static int skinny_extensionstate_cb(char *context, char *exten, struct ast_state_cb_info *info, void *data)
+static int skinny_extensionstate_cb(const char *context, const char *exten, struct ast_state_cb_info *info, void *data)
{
struct skinny_container *container = data;
struct skinny_device *d = NULL;
diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h
index 3b3b841..0970752 100644
--- a/include/asterisk/pbx.h
+++ b/include/asterisk/pbx.h
@@ -109,7 +109,7 @@
};
/*! \brief Typedef for devicestate and hint callbacks */
-typedef int (*ast_state_cb_type)(char *context, char *id, struct ast_state_cb_info *info, void *data);
+typedef int (*ast_state_cb_type)(const char *context, const char *exten, struct ast_state_cb_info *info, void *data);
/*! \brief Typedef for devicestate and hint callback removal indication callback */
typedef void (*ast_state_cb_destroy_type)(int id, void *data);
diff --git a/main/manager.c b/main/manager.c
index e74b253..74e9533 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -6765,7 +6765,7 @@
return 0;
}
-static int manager_state_cb(char *context, char *exten, struct ast_state_cb_info *info, void *data)
+static int manager_state_cb(const char *context, const char *exten, struct ast_state_cb_info *info, void *data)
{
/* Notify managers of change */
char hint[512];
diff --git a/main/pbx.c b/main/pbx.c
index 7efbdee..a8128ab 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -3231,8 +3231,7 @@
info.exten_state = AST_EXTENSION_REMOVED;
}
- /* NOTE: The casts will not be needed for v10 and later */
- res = cb((char *) context, (char *) exten, &info, data);
+ res = cb(context, exten, &info, data);
return res;
}
diff --git a/res/res_pjsip_exten_state.c b/res/res_pjsip_exten_state.c
index 27d16bd..a4ad1cd 100644
--- a/res/res_pjsip_exten_state.c
+++ b/res/res_pjsip_exten_state.c
@@ -191,8 +191,9 @@
ast_free(task_data->exten_state_data.user_agent);
}
-static struct notify_task_data *alloc_notify_task_data(char *exten, struct exten_state_subscription *exten_state_sub,
- struct ast_state_cb_info *info)
+static struct notify_task_data *alloc_notify_task_data(const char *exten,
+ struct exten_state_subscription *exten_state_sub,
+ struct ast_state_cb_info *info)
{
struct notify_task_data *task_data =
ao2_alloc(sizeof(*task_data), notify_task_data_destructor);
@@ -270,8 +271,8 @@
*
* Upon state change, send the appropriate notification to the subscriber.
*/
-static int state_changed(char *context, char *exten,
- struct ast_state_cb_info *info, void *data)
+static int state_changed(const char *context, const char *exten,
+ struct ast_state_cb_info *info, void *data)
{
struct notify_task_data *task_data;
struct exten_state_subscription *exten_state_sub = data;
--
To view, visit https://gerrit.asterisk.org/2560
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I346cdb3032b6478ceb40eb6fe732978b54035572
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
More information about the asterisk-code-review
mailing list