From 4ccf2c7aa5e8be4a7f38170c3e7a3d1fa5beed9c Mon Sep 17 00:00:00 2001 From: Richard Mudgett Date: Wed, 21 Nov 2012 18:33:16 +0000 Subject: Add red-black tree container type to astobj2. * Add red-black tree container type. * Add CLI command "astobj2 container dump " * 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 --- main/test.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'main/test.c') diff --git a/main/test.c b/main/test.c index 16973ba1e..b5c3d7d5d 100644 --- a/main/test.c +++ b/main/test.c @@ -100,6 +100,27 @@ static int test_insert(struct ast_test *test); static struct ast_test *test_remove(ast_test_cb_t *cb); static int test_cat_cmp(const char *cat1, const char *cat2); +void ast_test_debug(struct ast_test *test, const char *fmt, ...) +{ + struct ast_str *buf = NULL; + va_list ap; + + buf = ast_str_create(128); + if (!buf) { + return; + } + + va_start(ap, fmt); + ast_str_set_va(&buf, 0, fmt, ap); + va_end(ap); + + if (test->cli) { + ast_cli(test->cli->fd, "%s", ast_str_buffer(buf)); + } + + ast_free(buf); +} + int __ast_test_status_update(const char *file, const char *func, int line, struct ast_test *test, const char *fmt, ...) { -- cgit v1.2.3