aboutsummaryrefslogtreecommitdiffstats
path: root/rtp.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-03 17:08:35 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-03 17:08:35 +0000
commit852c5ac7f590c59c1b73680aa78a44231264b8ab (patch)
treec1fe7e931e561ad08e2a4caf937d93f4311df2ea /rtp.c
parent9c0ea79199d22b6cafbdcd426db18c9ef074ae0f (diff)
fix breakage from rev 7730 (failure to unlock list in get_proto)
minor cleanups and simpler usage of list macros git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7739 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'rtp.c')
-rw-r--r--rtp.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/rtp.c b/rtp.c
index 3f0f7452a..bb72376f6 100644
--- a/rtp.c
+++ b/rtp.c
@@ -738,16 +738,16 @@ static void ast_rtp_pt_copy(struct ast_rtp *dest, struct ast_rtp *src)
/*! \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 @@ int ast_rtp_write(struct ast_rtp *rtp, struct ast_frame *_f)
/*! \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 @@ int ast_rtp_proto_register(struct ast_rtp_protocol *proto)
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;