[asterisk-commits] dlee: branch dlee/stasis-vtable r390427 - in /team/dlee/stasis-vtable: includ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jun 4 12:36:57 CDT 2013
Author: dlee
Date: Tue Jun 4 12:36:55 2013
New Revision: 390427
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390427
Log:
Giving in to peer pressure and removing ast_ref1()
Modified:
team/dlee/stasis-vtable/include/asterisk/astobj2.h
team/dlee/stasis-vtable/main/stasis_channels.c
team/dlee/stasis-vtable/tests/test_astobj2.c
Modified: team/dlee/stasis-vtable/include/asterisk/astobj2.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-vtable/include/asterisk/astobj2.h?view=diff&rev=390427&r1=390426&r2=390427
==============================================================================
--- team/dlee/stasis-vtable/include/asterisk/astobj2.h (original)
+++ team/dlee/stasis-vtable/include/asterisk/astobj2.h Tue Jun 4 12:36:55 2013
@@ -509,35 +509,6 @@
#define ao2_ref(o,delta) __ao2_ref((o), (delta))
#endif
-
-/*!
- * \brief Convenient, \c NULL safe wrapper for ao2_ref(obj, +1).
- *
- * \param o Object to bump refcount on, or \c NULL.
- */
-#define ao2_ref1(o) \
- ({ \
- typeof((o)) __obj_ ## __LINE__ = (o); \
- if (__obj_ ## __LINE__) { \
- ao2_ref(__obj_ ## __LINE__, +1); \
- } \
- __obj_ ## __LINE__; \
- })
-
-/*!
- * \brief Convenient, \c NULL safe wrapper for ao2_ref(obj, +1).
- *
- * \param o Object to bump refcount on, or \c NULL.
- * \param tag Debug tag.
- */
-#define ao2_t_ref1(o,tag) \
- ({ \
- typeof((o)) __obj_ ## __LINE__ = (o); \
- if (__obj_ ## __LINE__) { \
- ao2_t_ref(__obj_ ## __LINE__, +1, (tag)); \
- } \
- __obj_ ## __LINE__; \
- })
int __ao2_ref_debug(void *o, int delta, const char *tag, const char *file, int line, const char *func);
int __ao2_ref(void *o, int delta);
Modified: team/dlee/stasis-vtable/main/stasis_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-vtable/main/stasis_channels.c?view=diff&rev=390427&r1=390426&r2=390427
==============================================================================
--- team/dlee/stasis-vtable/main/stasis_channels.c (original)
+++ team/dlee/stasis-vtable/main/stasis_channels.c Tue Jun 4 12:36:55 2013
@@ -486,7 +486,6 @@
static struct ast_manager_event_blob *varset_to_ami(struct stasis_message *msg)
{
- RAII_VAR(struct ast_manager_event_blob *, ev, NULL, ao2_cleanup);
RAII_VAR(struct ast_str *, channel_event_string, NULL, ast_free);
struct ast_channel_blob *obj = stasis_message_data(msg);
const char *variable =
@@ -508,13 +507,11 @@
return NULL;
}
- ev = ast_manager_event_blob_create(EVENT_FLAG_DIALPLAN, "VarSet",
+ return ast_manager_event_blob_create(EVENT_FLAG_DIALPLAN, "VarSet",
"%s"
"Variable: %s\r\n"
"Value: %s\r\n",
ast_str_buffer(channel_event_string), variable, value);
-
- return ao2_ref1(ev);
}
void ast_publish_channel_state(struct ast_channel *chan)
Modified: team/dlee/stasis-vtable/tests/test_astobj2.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-vtable/tests/test_astobj2.c?view=diff&rev=390427&r1=390426&r2=390427
==============================================================================
--- team/dlee/stasis-vtable/tests/test_astobj2.c (original)
+++ team/dlee/stasis-vtable/tests/test_astobj2.c Tue Jun 4 12:36:55 2013
@@ -2059,42 +2059,12 @@
return res;
}
-AST_TEST_DEFINE(astobj2_ref1)
-{
- RAII_VAR(void *, obj, NULL, ao2_cleanup);
- RAII_VAR(void *, refed_obj, NULL, ao2_cleanup);
-
- switch (cmd) {
- case TEST_INIT:
- info->name = "astobj2_ref1";
- info->category = "/main/astobj2/";
- info->summary = "Test the ao2_ref1 macro";
- info->description =
- "This test determines if the ao2_ref1 macro works as "
- "expected.";
- return AST_TEST_NOT_RUN;
- case TEST_EXECUTE:
- break;
- }
-
- obj = ao2_alloc(1, NULL);
- ast_test_validate(test, NULL != obj);
- ast_test_validate(test, 1 == ao2_ref(obj, 0));
-
- refed_obj = ao2_ref1(obj);
- ast_test_validate(test, obj == refed_obj);
- ast_test_validate(test, 2 == ao2_ref(obj, 0));
-
- return AST_TEST_PASS;
-}
-
static int unload_module(void)
{
AST_TEST_UNREGISTER(astobj2_test_1);
AST_TEST_UNREGISTER(astobj2_test_2);
AST_TEST_UNREGISTER(astobj2_test_3);
AST_TEST_UNREGISTER(astobj2_test_4);
- AST_TEST_UNREGISTER(astobj2_ref1);
return 0;
}
@@ -2104,7 +2074,6 @@
AST_TEST_REGISTER(astobj2_test_2);
AST_TEST_REGISTER(astobj2_test_3);
AST_TEST_REGISTER(astobj2_test_4);
- AST_TEST_REGISTER(astobj2_ref1);
return AST_MODULE_LOAD_SUCCESS;
}
More information about the asterisk-commits
mailing list