diff options
author | Richard Mudgett <rmudgett@digium.com> | 2012-11-21 18:33:16 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2012-11-21 18:33:16 +0000 |
commit | 4ccf2c7aa5e8be4a7f38170c3e7a3d1fa5beed9c (patch) | |
tree | 3cd809184b0d4490e359f6f23a32a8071f092880 /main/channel.c | |
parent | cc01a794631bcd794ff84dd31f466562c9464f3e (diff) |
Add red-black tree container type to astobj2.
* Add red-black tree container type.
* Add CLI command "astobj2 container dump <name>"
* Added ao2_container_dump() so the container could be dumped by other
modules for debugging purposes.
* Changed ao2_container_stats() so it can be used by other modules like
ao2_container_check() for debugging purposes.
* Updated the unit tests to check red-black tree containers.
(closes issue ASTERISK-19970)
Reported by: rmudgett
Tested by: rmudgett
Review: https://reviewboard.asterisk.org/r/2110/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376575 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/channel.c')
-rw-r--r-- | main/channel.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/main/channel.c b/main/channel.c index 9edb0cc7f..37fda09f1 100644 --- a/main/channel.c +++ b/main/channel.c @@ -8596,6 +8596,27 @@ static const struct ast_data_entry channel_providers[] = { AST_DATA_ENTRY("/asterisk/core/channeltypes", &channeltypes_provider), }; +/*! + * \internal + * \brief Print channel object key (name). + * \since 12.0.0 + * + * \param v_obj A pointer to the object we want the key printed. + * \param where User data needed by prnt to determine where to put output. + * \param prnt Print output callback function to use. + * + * \return Nothing + */ +static void prnt_channel_key(void *v_obj, void *where, ao2_prnt_fn *prnt) +{ + struct ast_channel *chan = v_obj; + + if (!chan) { + return; + } + prnt(where, "%s", ast_channel_name(chan)); +} + static void channels_shutdown(void) { ast_data_unregister(NULL); @@ -8610,7 +8631,7 @@ void ast_channels_init(void) channels = ao2_container_alloc(NUM_CHANNEL_BUCKETS, ast_channel_hash_cb, ast_channel_cmp_cb); if (channels) { - ao2_container_register("channels", channels); + ao2_container_register("channels", channels, prnt_channel_key); } ast_cli_register_multiple(cli_channel, ARRAY_LEN(cli_channel)); |