diff options
author | Automerge script <automerge@asterisk.org> | 2013-01-09 22:20:40 +0000 |
---|---|---|
committer | Automerge script <automerge@asterisk.org> | 2013-01-09 22:20:40 +0000 |
commit | 7a06fdad8916a932e7321f65675fce9950ea8ea1 (patch) | |
tree | cec59a5e6b310f5bb66c6d4209713799b462fbfa | |
parent | 613b972cc595499fc748c28fce7b568c5caa3bd1 (diff) |
Merged revisions 378823 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk
........
r378823 | rmudgett | 2013-01-09 16:15:41 -0600 (Wed, 09 Jan 2013) | 2 lines
Tweaked __ast_test_suite_assert_notify() and __ast_test_suite_event_notify() to be void functions.
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@378833 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | include/asterisk/test.h | 22 | ||||
-rw-r--r-- | main/test.c | 10 |
2 files changed, 15 insertions, 17 deletions
diff --git a/include/asterisk/test.h b/include/asterisk/test.h index e8584aab5..ea79385d8 100644 --- a/include/asterisk/test.h +++ b/include/asterisk/test.h @@ -145,10 +145,9 @@ * \param state The state the application has changed to * \param fmt The message with format parameters to add to the manager event * - * \returns 0 on success - * \returns any other value on failure + * \return Nothing */ -int __ast_test_suite_event_notify(const char *file, const char *func, int line, const char *state, const char *fmt, ...) +void __ast_test_suite_event_notify(const char *file, const char *func, int line, const char *state, const char *fmt, ...) __attribute__((format(printf, 5, 6))); /*! @@ -161,10 +160,9 @@ int __ast_test_suite_event_notify(const char *file, const char *func, int line, * * \param exp The expression to evaluate * - * \returns 0 on success - * \returns any other value on failure + * \return Nothing */ -int __ast_test_suite_assert_notify(const char *file, const char *func, int line, const char *exp); +void __ast_test_suite_assert_notify(const char *file, const char *func, int line, const char *exp); /*! * \ref __ast_test_suite_event_notify() @@ -175,13 +173,17 @@ int __ast_test_suite_assert_notify(const char *file, const char *func, int line, /*! * \ref __ast_test_suite_assert_notify() */ -#define ast_test_suite_assert(exp) \ - ( (exp) ? (void)0 : __ast_test_suite_assert_notify(__FILE__, __PRETTY_FUNCTION__, __LINE__, #exp)) +#define ast_test_suite_assert(exp) \ + do { \ + if (__builtin_expect(!(exp), 1)) { \ + __ast_test_suite_assert_notify(__FILE__, __PRETTY_FUNCTION__, __LINE__, #exp); \ + } \ + } while (0) #else -#define ast_test_suite_event_notify(s, f, ...) (void)0; -#define ast_test_suite_assert(exp) (void)0; +#define ast_test_suite_event_notify(s, f, ...) +#define ast_test_suite_assert(exp) #endif diff --git a/main/test.c b/main/test.c index 60676cb84..612697a15 100644 --- a/main/test.c +++ b/main/test.c @@ -910,13 +910,13 @@ static struct ast_cli_entry test_cli[] = { AST_CLI_DEFINE(test_cli_generate_results, "generate test results to file"), }; -int __ast_test_suite_event_notify(const char *file, const char *func, int line, const char *state, const char *fmt, ...) +void __ast_test_suite_event_notify(const char *file, const char *func, int line, const char *state, const char *fmt, ...) { struct ast_str *buf = NULL; va_list ap; if (!(buf = ast_str_create(128))) { - return -1; + return; } va_start(ap, fmt); @@ -933,11 +933,9 @@ int __ast_test_suite_event_notify(const char *file, const char *func, int line, state, file, func, line, ast_str_buffer(buf)); ast_free(buf); - - return 0; } -int __ast_test_suite_assert_notify(const char *file, const char *func, int line, const char *exp) +void __ast_test_suite_assert_notify(const char *file, const char *func, int line, const char *exp) { manager_event(EVENT_FLAG_TEST, "TestEvent", "Type: Assert\r\n" @@ -946,8 +944,6 @@ int __ast_test_suite_assert_notify(const char *file, const char *func, int line, "AppLine: %d\r\n" "Expression: %s\r\n", file, func, line, exp); - - return 0; } #endif /* TEST_FRAMEWORK */ |