[asterisk-commits] trunk - r7739 /trunk/rtp.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Jan 3 11:08:36 CST 2006


Author: kpfleming
Date: Tue Jan  3 11:08:35 2006
New Revision: 7739

URL: http://svn.digium.com/view/asterisk?rev=7739&view=rev
Log:
fix breakage from rev 7730 (failure to unlock list in get_proto)
minor cleanups and simpler usage of list macros

Modified:
    trunk/rtp.c

Modified: trunk/rtp.c
URL: http://svn.digium.com/view/asterisk/trunk/rtp.c?rev=7739&r1=7738&r2=7739&view=diff
==============================================================================
--- trunk/rtp.c (original)
+++ trunk/rtp.c Tue Jan  3 11:08:35 2006
@@ -738,16 +738,16 @@
 /*! \brief Get channel driver interface structure */
 static struct ast_rtp_protocol *get_proto(struct ast_channel *chan)
 {
-	struct ast_rtp_protocol *cur;
+	struct ast_rtp_protocol *cur = NULL;
 
 	AST_LIST_LOCK(&protos);
 	AST_LIST_TRAVERSE(&protos, cur, list) {
 		if (cur->type == chan->type)
-			return cur;
+			break;
 	}
 	AST_LIST_UNLOCK(&protos);
 
-	return NULL;
+	return cur;
 }
 
 int ast_rtp_make_compatible(struct ast_channel *dest, struct ast_channel *src)
@@ -1533,16 +1533,8 @@
 /*! \brief Unregister interface to channel driver */
 void ast_rtp_proto_unregister(struct ast_rtp_protocol *proto)
 {
-	struct ast_rtp_protocol *cur;
-
 	AST_LIST_LOCK(&protos);
-	AST_LIST_TRAVERSE_SAFE_BEGIN(&protos, cur, list) {	
-		if (cur == proto) {
-			AST_LIST_REMOVE_CURRENT(&protos, list);
-			break;
-		}
-	}
-	AST_LIST_TRAVERSE_SAFE_END
+	AST_LIST_REMOVE(&protos, proto, list);
 	AST_LIST_UNLOCK(&protos);
 }
 
@@ -1553,7 +1545,7 @@
 
 	AST_LIST_LOCK(&protos);
 	AST_LIST_TRAVERSE(&protos, cur, list) {	
-		if (cur->type == proto->type) {
+		if (!strcmp(cur->type, proto->type)) {
 			ast_log(LOG_WARNING, "Tried to register same protocol '%s' twice\n", cur->type);
 			AST_LIST_UNLOCK(&protos);
 			return -1;



More information about the asterisk-commits mailing list