mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 02:26:23 +00:00
Merge "res_pjsip_mwi.c: Use safer loop coding in mwi_subscription_mailboxes_str()."
This commit is contained in:
@@ -782,16 +782,16 @@ static void *mwi_get_notify_data(struct ast_sip_subscription *sub)
|
|||||||
static void mwi_subscription_mailboxes_str(struct ao2_container *stasis_subs,
|
static void mwi_subscription_mailboxes_str(struct ao2_container *stasis_subs,
|
||||||
struct ast_str **str)
|
struct ast_str **str)
|
||||||
{
|
{
|
||||||
int num = ao2_container_count(stasis_subs);
|
int is_first = 1;
|
||||||
|
|
||||||
struct mwi_stasis_subscription *node;
|
struct mwi_stasis_subscription *node;
|
||||||
struct ao2_iterator i = ao2_iterator_init(stasis_subs, 0);
|
struct ao2_iterator i = ao2_iterator_init(stasis_subs, 0);
|
||||||
|
|
||||||
while ((node = ao2_iterator_next(&i))) {
|
while ((node = ao2_iterator_next(&i))) {
|
||||||
if (--num) {
|
if (is_first) {
|
||||||
ast_str_append(str, 0, "%s,", node->mailbox);
|
is_first = 0;
|
||||||
} else {
|
|
||||||
ast_str_append(str, 0, "%s", node->mailbox);
|
ast_str_append(str, 0, "%s", node->mailbox);
|
||||||
|
} else {
|
||||||
|
ast_str_append(str, 0, ",%s", node->mailbox);
|
||||||
}
|
}
|
||||||
ao2_ref(node, -1);
|
ao2_ref(node, -1);
|
||||||
}
|
}
|
||||||
@@ -846,7 +846,9 @@ static int serialized_cleanup(void *userdata)
|
|||||||
static int send_notify(void *obj, void *arg, int flags)
|
static int send_notify(void *obj, void *arg, int flags)
|
||||||
{
|
{
|
||||||
struct mwi_subscription *mwi_sub = obj;
|
struct mwi_subscription *mwi_sub = obj;
|
||||||
struct ast_taskprocessor *serializer = mwi_sub->is_solicited ? ast_sip_subscription_get_serializer(mwi_sub->sip_sub) : NULL;
|
struct ast_taskprocessor *serializer = mwi_sub->is_solicited
|
||||||
|
? ast_sip_subscription_get_serializer(mwi_sub->sip_sub)
|
||||||
|
: NULL;
|
||||||
|
|
||||||
if (ast_sip_push_task(serializer, serialized_notify, ao2_bump(mwi_sub))) {
|
if (ast_sip_push_task(serializer, serialized_notify, ao2_bump(mwi_sub))) {
|
||||||
ao2_ref(mwi_sub, -1);
|
ao2_ref(mwi_sub, -1);
|
||||||
|
Reference in New Issue
Block a user