[asterisk-commits] rmudgett: branch rmudgett/cel_accountcode r417584 - /team/rmudgett/cel_accoun...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jun 27 22:47:55 CDT 2014


Author: rmudgett
Date: Fri Jun 27 22:47:48 2014
New Revision: 417584

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=417584
Log:
bridge_channel: Use channel pointers instead of always dereferencing bridge_channel pointers.

Modified:
    team/rmudgett/cel_accountcode/main/bridge_channel.c

Modified: team/rmudgett/cel_accountcode/main/bridge_channel.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cel_accountcode/main/bridge_channel.c?view=diff&rev=417584&r1=417583&r2=417584
==============================================================================
--- team/rmudgett/cel_accountcode/main/bridge_channel.c (original)
+++ team/rmudgett/cel_accountcode/main/bridge_channel.c Fri Jun 27 22:47:48 2014
@@ -387,21 +387,21 @@
  * \brief Set dest's empty peeraccount with the src's non-empty accountcode.
  * \since 12.4.0
  *
- * \param dest Bridge channel to update peeraccount.
- * \param src Bridge channel to get accountcode from.
- *
- * \note Both bridge_channels are already locked.
+ * \param dest Channel to update peeraccount.
+ * \param src Channel to get accountcode from.
+ *
+ * \note Both channels are already locked.
  *
  * \return Nothing
  */
-static void bridge_channel_fill_empty_peeraccount(struct ast_bridge_channel *dest, struct ast_bridge_channel *src)
-{
-	if (ast_strlen_zero(ast_channel_peeraccount(dest->chan))
-		&& !ast_strlen_zero(ast_channel_accountcode(src->chan))) {
+static void channel_fill_empty_peeraccount(struct ast_channel *dest, struct ast_channel *src)
+{
+	if (ast_strlen_zero(ast_channel_peeraccount(dest))
+		&& !ast_strlen_zero(ast_channel_accountcode(src))) {
 		ast_debug(1, "Setting channel %s peeraccount with channel %s accountcode '%s'.\n",
-			ast_channel_name(dest->chan),
-			ast_channel_name(src->chan), ast_channel_accountcode(src->chan));
-		ast_channel_peeraccount_set(dest->chan, ast_channel_accountcode(src->chan));
+			ast_channel_name(dest),
+			ast_channel_name(src), ast_channel_accountcode(src));
+		ast_channel_peeraccount_set(dest, ast_channel_accountcode(src));
 	}
 }
 
@@ -410,21 +410,21 @@
  * \brief Set dest's empty accountcode with the src's non-empty peeraccount.
  * \since 12.4.0
  *
- * \param dest Bridge channel to update accountcode.
- * \param src Bridge channel to get peeraccount from.
- *
- * \note Both bridge_channels are already locked.
+ * \param dest Channel to update accountcode.
+ * \param src Channel to get peeraccount from.
+ *
+ * \note Both channels are already locked.
  *
  * \return Nothing
  */
-static void bridge_channel_fill_empty_accountcode(struct ast_bridge_channel *dest, struct ast_bridge_channel *src)
-{
-	if (ast_strlen_zero(ast_channel_accountcode(dest->chan))
-		&& !ast_strlen_zero(ast_channel_peeraccount(src->chan))) {
+static void channel_fill_empty_accountcode(struct ast_channel *dest, struct ast_channel *src)
+{
+	if (ast_strlen_zero(ast_channel_accountcode(dest))
+		&& !ast_strlen_zero(ast_channel_peeraccount(src))) {
 		ast_debug(1, "Setting channel %s accountcode with channel %s peeraccount '%s'.\n",
-			ast_channel_name(dest->chan),
-			ast_channel_name(src->chan), ast_channel_peeraccount(src->chan));
-		ast_channel_accountcode_set(dest->chan, ast_channel_peeraccount(src->chan));
+			ast_channel_name(dest),
+			ast_channel_name(src), ast_channel_peeraccount(src));
+		ast_channel_accountcode_set(dest, ast_channel_peeraccount(src));
 	}
 }
 
@@ -433,22 +433,22 @@
  * \brief Set empty peeraccount and accountcode in a channel from the other channel.
  * \since 12.4.0
  *
- * \param bc0 First bridge channel to update.
- * \param bc1 Second bridge channel to update.
- *
- * \note Both bridge_channels are already locked.
+ * \param c0 First bridge channel to update.
+ * \param c1 Second bridge channel to update.
+ *
+ * \note Both channels are already locked.
  *
  * \return Nothing
  */
-static void bridge_channel_set_empty_accountcodes(struct ast_bridge_channel *bc0, struct ast_bridge_channel *bc1)
+static void channel_set_empty_accountcodes(struct ast_channel *c0, struct ast_channel *c1)
 {
 	/* Set empty peeraccount from the other channel's accountcode. */
-	bridge_channel_fill_empty_peeraccount(bc0, bc1);
-	bridge_channel_fill_empty_peeraccount(bc1, bc0);
+	channel_fill_empty_peeraccount(c0, c1);
+	channel_fill_empty_peeraccount(c1, c0);
 
 	/* Set empty accountcode from the other channel's peeraccount. */
-	bridge_channel_fill_empty_accountcode(bc0, bc1);
-	bridge_channel_fill_empty_accountcode(bc1, bc0);
+	channel_fill_empty_accountcode(c0, c1);
+	channel_fill_empty_accountcode(c1, c0);
 }
 
 /*!
@@ -456,20 +456,20 @@
  * \brief Update dest's peeraccount with the src's different accountcode.
  * \since 12.4.0
  *
- * \param dest Bridge channel to update peeraccount.
- * \param src Bridge channel to get accountcode from.
- *
- * \note Both bridge_channels are already locked.
+ * \param dest Channel to update peeraccount.
+ * \param src Channel to get accountcode from.
+ *
+ * \note Both channels are already locked.
  *
  * \return Nothing
  */
-static void bridge_channel_update_peeraccount(struct ast_bridge_channel *dest, struct ast_bridge_channel *src)
-{
-	if (strcmp(ast_channel_accountcode(src->chan), ast_channel_peeraccount(dest->chan))) {
+static void channel_update_peeraccount(struct ast_channel *dest, struct ast_channel *src)
+{
+	if (strcmp(ast_channel_accountcode(src), ast_channel_peeraccount(dest))) {
 		ast_debug(1, "Changing channel %s peeraccount '%s' to match channel %s accountcode '%s'.\n",
-			ast_channel_name(dest->chan), ast_channel_peeraccount(dest->chan),
-			ast_channel_name(src->chan), ast_channel_accountcode(src->chan));
-		ast_channel_peeraccount_set(dest->chan, ast_channel_accountcode(src->chan));
+			ast_channel_name(dest), ast_channel_peeraccount(dest),
+			ast_channel_name(src), ast_channel_accountcode(src));
+		ast_channel_peeraccount_set(dest, ast_channel_accountcode(src));
 	}
 }
 
@@ -478,17 +478,17 @@
  * \brief Update peeraccounts to match the other channel's accountcode.
  * \since 12.4.0
  *
- * \param bc0 First bridge channel to update.
- * \param bc1 Second bridge channel to update.
- *
- * \note Both bridge_channels are already locked.
+ * \param c0 First channel to update.
+ * \param c1 Second channel to update.
+ *
+ * \note Both channels are already locked.
  *
  * \return Nothing
  */
-static void bridge_channel_update_peeraccounts(struct ast_bridge_channel *bc0, struct ast_bridge_channel *bc1)
-{
-	bridge_channel_update_peeraccount(bc0, bc1);
-	bridge_channel_update_peeraccount(bc1, bc0);
+static void channel_update_peeraccounts(struct ast_channel *c0, struct ast_channel *c1)
+{
+	channel_update_peeraccount(c0, c1);
+	channel_update_peeraccount(c1, c0);
 }
 
 /*!
@@ -530,9 +530,9 @@
 		}
 		ast_assert(joining != other);
 		ast_channel_lock_both(joining->chan, other->chan);
-		bridge_channel_set_empty_accountcodes(joining, other);
+		channel_set_empty_accountcodes(joining->chan, other->chan);
 		if (will_be_two_party) {
-			bridge_channel_update_peeraccounts(joining, other);
+			channel_update_peeraccounts(joining->chan, other->chan);
 		}
 		ast_channel_unlock(joining->chan);
 		ast_channel_unlock(other->chan);
@@ -564,8 +564,8 @@
 	second = AST_LIST_LAST(&bridge->channels);
 	ast_assert(first && first != second);
 	ast_channel_lock_both(first->chan, second->chan);
-	bridge_channel_set_empty_accountcodes(first, second);
-	bridge_channel_update_peeraccounts(first, second);
+	channel_set_empty_accountcodes(first->chan, second->chan);
+	channel_update_peeraccounts(first->chan, second->chan);
 	ast_channel_unlock(second->chan);
 	ast_channel_unlock(first->chan);
 }




More information about the asterisk-commits mailing list