[asterisk-commits] russell: branch russell/ast_channel_ao2 r174159 - /team/russell/ast_channel_a...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Feb 7 10:18:56 CST 2009
Author: russell
Date: Sat Feb 7 10:18:56 2009
New Revision: 174159
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=174159
Log:
convert part of res_snmp
Modified:
team/russell/ast_channel_ao2/res/snmp/agent.c
Modified: team/russell/ast_channel_ao2/res/snmp/agent.c
URL: http://svn.digium.com/svn-view/asterisk/team/russell/ast_channel_ao2/res/snmp/agent.c?view=diff&rev=174159&r1=174158&r2=174159
==============================================================================
--- team/russell/ast_channel_ao2/res/snmp/agent.c (original)
+++ team/russell/ast_channel_ao2/res/snmp/agent.c Sat Feb 7 10:18:56 2009
@@ -236,18 +236,31 @@
u_char *ret = NULL;
int i, bit;
struct ast_str *out = ast_str_alloca(2048);
+ struct ast_channel_iterator *iter;
if (header_simple_table(vp, name, length, exact, var_len, write_method, ast_active_channels()))
return NULL;
i = name[*length - 1] - 1;
- for (chan = ast_channel_walk_locked(NULL);
- chan && i;
- chan = ast_channel_walk_locked(chan), i--)
- ast_channel_unlock(chan);
- if (chan == NULL)
- return NULL;
+
+ if (!(iter = ast_channel_iterator_all_new(0))) {
+ return NULL;
+ }
+
+ while ((chan = ast_channel_iterator_next(iter)) && i) {
+ ast_channel_unref(chan);
+ i--;
+ }
+
+ iter = ast_channel_iterator_destroy(iter);
+
+ if (chan == NULL) {
+ return NULL;
+ }
+
*var_len = sizeof(long_ret);
+
+ ast_channel_lock(chan);
switch (vp->magic) {
case ASTCHANINDEX:
@@ -503,7 +516,10 @@
default:
break;
}
+
ast_channel_unlock(chan);
+ chan = ast_channel_unref(chan);
+
return ret;
}
More information about the asterisk-commits
mailing list