[asterisk-commits] murf: branch murf/bug11210 r105583 - in /team/murf/bug11210: ./ include/aster...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Mar 3 18:13:23 CST 2008
Author: murf
Date: Mon Mar 3 18:13:23 2008
New Revision: 105583
URL: http://svn.digium.com/view/asterisk?view=rev&rev=105583
Log:
The astobj2 changes that Russell seeks are here. I have to svnmerge, and then test, so there may be more changes.
Modified:
team/murf/bug11210/ (props changed)
team/murf/bug11210/include/asterisk/astobj2.h
team/murf/bug11210/main/astobj2.c
Propchange: team/murf/bug11210/
------------------------------------------------------------------------------
automerge = yes
Modified: team/murf/bug11210/include/asterisk/astobj2.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/include/asterisk/astobj2.h?view=diff&rev=105583&r1=105582&r2=105583
==============================================================================
--- team/murf/bug11210/include/asterisk/astobj2.h (original)
+++ team/murf/bug11210/include/asterisk/astobj2.h Mon Mar 3 18:13:23 2008
@@ -400,15 +400,17 @@
#ifdef REF_DEBUG
-#define ao2_t_alloc(arg1, arg2, arg3) ao2_alloc_debug((arg1), (arg2), (arg3), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define ao2_t_alloc(arg1, arg2, arg3) _ao2_alloc_debug((arg1), (arg2), (arg3), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define ao2_alloc(arg1, arg2) _ao2_alloc_debug((arg1), (arg2), "", __FILE__, __LINE__, __PRETTY_FUNCTION__)
#else
-#define ao2_t_alloc(arg1,arg2,arg3) ao2_alloc((arg1), (arg2))
+#define ao2_t_alloc(arg1,arg2,arg3) _ao2_alloc((arg1), (arg2))
+#define ao2_alloc(arg1,arg2) _ao2_alloc((arg1), (arg2))
#endif
-void *ao2_alloc_debug(const size_t data_size, ao2_destructor_fn destructor_fn, char *tag, char *file, int line, const char *funcname);
-void *ao2_alloc(const size_t data_size, ao2_destructor_fn destructor_fn);
+void *_ao2_alloc_debug(const size_t data_size, ao2_destructor_fn destructor_fn, char *tag, char *file, int line, const char *funcname);
+void *_ao2_alloc(const size_t data_size, ao2_destructor_fn destructor_fn);
/*! \brief
@@ -433,12 +435,14 @@
*/
#ifdef REF_DEBUG
-#define ao2_t_ref(arg1,arg2,arg3) ao2_ref_debug((arg1), (arg2), (arg3), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define ao2_t_ref(arg1,arg2,arg3) _ao2_ref_debug((arg1), (arg2), (arg3), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define ao2_ref(arg1,arg2) _ao2_ref_debug((arg1), (arg2), "", __FILE__, __LINE__, __PRETTY_FUNCTION__)
#else
-#define ao2_t_ref(arg1,arg2,arg3) ao2_ref((arg1), (arg2))
+#define ao2_t_ref(arg1,arg2,arg3) _ao2_ref((arg1), (arg2))
+#define ao2_ref(arg1,arg2) _ao2_ref((arg1), (arg2))
#endif
-int ao2_ref_debug(void *o, int delta, char *tag, char *file, int line, const char *funcname);
-int ao2_ref(void *o, int delta);
+int _ao2_ref_debug(void *o, int delta, char *tag, char *file, int line, const char *funcname);
+int _ao2_ref(void *o, int delta);
/*! \brief
* Lock an object.
@@ -628,13 +632,15 @@
*/
#ifdef REF_DEBUG
-#define ao2_t_container_alloc(arg1,arg2,arg3,arg4) ao2_container_alloc_debug((arg1), (arg2), (arg3), (arg4), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define ao2_t_container_alloc(arg1,arg2,arg3,arg4) _ao2_container_alloc_debug((arg1), (arg2), (arg3), (arg4), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define ao2_container_alloc(arg1,arg2,arg3) _ao2_container_alloc_debug((arg1), (arg2), (arg3), "", __FILE__, __LINE__, __PRETTY_FUNCTION__)
#else
-#define ao2_t_container_alloc(arg1,arg2,arg3,arg4) ao2_container_alloc((arg1), (arg2), (arg3))
+#define ao2_t_container_alloc(arg1,arg2,arg3,arg4) _ao2_container_alloc((arg1), (arg2), (arg3))
+#define ao2_container_alloc(arg1,arg2,arg3) _ao2_container_alloc((arg1), (arg2), (arg3))
#endif
-struct ao2_container *ao2_container_alloc(const uint n_buckets,
+struct ao2_container *_ao2_container_alloc(const uint n_buckets,
ao2_hash_fn *hash_fn, ao2_callback_fn *cmp_fn);
-struct ao2_container *ao2_container_alloc_debug(const uint n_buckets,
+struct ao2_container *_ao2_container_alloc_debug(const uint n_buckets,
ao2_hash_fn *hash_fn, ao2_callback_fn *cmp_fn,
char *tag, char *file, int line, const char *funcname);
@@ -670,12 +676,14 @@
*/
#ifdef REF_DEBUG
-#define ao2_t_link(arg1, arg2, arg3) ao2_link_debug((arg1), (arg2), (arg3), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define ao2_t_link(arg1, arg2, arg3) _ao2_link_debug((arg1), (arg2), (arg3), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define ao2_link(arg1, arg2) _ao2_link_debug((arg1), (arg2), "", __FILE__, __LINE__, __PRETTY_FUNCTION__)
#else
-#define ao2_t_link(arg1, arg2, arg3) ao2_link((arg1), (arg2))
+#define ao2_t_link(arg1, arg2, arg3) _ao2_link((arg1), (arg2))
+#define ao2_link(arg1, arg2) _ao2_link((arg1), (arg2))
#endif
-void *ao2_link_debug(struct ao2_container *c, void *new_obj, char *tag, char *file, int line, const char *funcname);
-void *ao2_link(struct ao2_container *c, void *newobj);
+void *_ao2_link_debug(struct ao2_container *c, void *new_obj, char *tag, char *file, int line, const char *funcname);
+void *_ao2_link(struct ao2_container *c, void *newobj);
/*!
* \brief Remove an object from the container
@@ -694,12 +702,14 @@
* refcount will be decremented).
*/
#ifdef REF_DEBUG
-#define ao2_t_unlink(arg1, arg2, arg3) ao2_unlink_debug((arg1), (arg2), (arg3), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define ao2_t_unlink(arg1, arg2, arg3) _ao2_unlink_debug((arg1), (arg2), (arg3), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define ao2_unlink(arg1, arg2) _ao2_unlink_debug((arg1), (arg2), "", __FILE__, __LINE__, __PRETTY_FUNCTION__)
#else
-#define ao2_t_unlink(arg1, arg2, arg3) ao2_unlink((arg1), (arg2))
+#define ao2_t_unlink(arg1, arg2, arg3) _ao2_unlink((arg1), (arg2))
+#define ao2_unlink(arg1, arg2) _ao2_unlink((arg1), (arg2))
#endif
-void *ao2_unlink_debug(struct ao2_container *c, void *obj, char *tag, char *file, int line, const char *funcname);
-void *ao2_unlink(struct ao2_container *c, void *obj);
+void *_ao2_unlink_debug(struct ao2_container *c, void *obj, char *tag, char *file, int line, const char *funcname);
+void *_ao2_unlink(struct ao2_container *c, void *obj);
/*! \brief Used as return value if the flag OBJ_MULTIPLE is set */
@@ -787,14 +797,16 @@
* be used to free the additional reference possibly created by this function.
*/
#ifdef REF_DEBUG
-#define ao2_t_callback(arg1,arg2,arg3,arg4,arg5) ao2_callback_debug((arg1), (arg2), (arg3), (arg4), (arg5), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define ao2_t_callback(arg1,arg2,arg3,arg4,arg5) _ao2_callback_debug((arg1), (arg2), (arg3), (arg4), (arg5), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define ao2_callback(arg1,arg2,arg3,arg4) _ao2_callback_debug((arg1), (arg2), (arg3), (arg4), "", __FILE__, __LINE__, __PRETTY_FUNCTION__)
#else
-#define ao2_t_callback(arg1,arg2,arg3,arg4,arg5) ao2_callback((arg1), (arg2), (arg3), (arg4))
+#define ao2_t_callback(arg1,arg2,arg3,arg4,arg5) _ao2_callback((arg1), (arg2), (arg3), (arg4))
+#define ao2_callback(arg1,arg2,arg3,arg4) _ao2_callback((arg1), (arg2), (arg3), (arg4))
#endif
-void *ao2_callback_debug(struct ao2_container *c, enum search_flags flags,
+void *_ao2_callback_debug(struct ao2_container *c, enum search_flags flags,
ao2_callback_fn *cb_fn, void *arg, char *tag,
char *file, int line, const char *funcname);
-void *ao2_callback(struct ao2_container *c,
+void *_ao2_callback(struct ao2_container *c,
enum search_flags flags,
ao2_callback_fn *cb_fn, void *arg);
@@ -802,12 +814,14 @@
* XXX possibly change order of arguments ?
*/
#ifdef REF_DEBUG
-#define ao2_t_find(arg1,arg2,arg3,arg4) ao2_find_debug((arg1), (arg2), (arg3), (arg4), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define ao2_t_find(arg1,arg2,arg3,arg4) _ao2_find_debug((arg1), (arg2), (arg3), (arg4), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define ao2_find(arg1,arg2,arg3) _ao2_find_debug((arg1), (arg2), (arg3), "", __FILE__, __LINE__, __PRETTY_FUNCTION__)
#else
-#define ao2_t_find(arg1,arg2,arg3,arg4) ao2_find((arg1), (arg2), (arg3))
+#define ao2_t_find(arg1,arg2,arg3,arg4) _ao2_find((arg1), (arg2), (arg3))
+#define ao2_find(arg1,arg2,arg3) _ao2_find((arg1), (arg2), (arg3))
#endif
-void *ao2_find_debug(struct ao2_container *c, void *arg, enum search_flags flags, char *tag, char *file, int line, const char *funcname);
-void *ao2_find(struct ao2_container *c, void *arg, enum search_flags flags);
+void *_ao2_find_debug(struct ao2_container *c, void *arg, enum search_flags flags, char *tag, char *file, int line, const char *funcname);
+void *_ao2_find(struct ao2_container *c, void *arg, enum search_flags flags);
/*! \brief
*
@@ -906,12 +920,14 @@
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags);
#ifdef REF_DEBUG
-#define ao2_t_iterator_next(arg1, arg2) ao2_iterator_next_debug((arg1), (arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define ao2_t_iterator_next(arg1, arg2) _ao2_iterator_next_debug((arg1), (arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define ao2_iterator_next(arg1) _ao2_iterator_next_debug((arg1), "", __FILE__, __LINE__, __PRETTY_FUNCTION__)
#else
-#define ao2_t_iterator_next(arg1, arg2) ao2_iterator_next((arg1))
+#define ao2_t_iterator_next(arg1, arg2) _ao2_iterator_next((arg1))
+#define ao2_iterator_next(arg1) _ao2_iterator_next((arg1))
#endif
-void *ao2_iterator_next_debug(struct ao2_iterator *a, char *tag, char *file, int line, const char *funcname);
-void *ao2_iterator_next(struct ao2_iterator *a);
+void *_ao2_iterator_next_debug(struct ao2_iterator *a, char *tag, char *file, int line, const char *funcname);
+void *_ao2_iterator_next(struct ao2_iterator *a);
/* extra functions */
void ao2_bt(void); /* backtrace */
Modified: team/murf/bug11210/main/astobj2.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/main/astobj2.c?view=diff&rev=105583&r1=105582&r2=105583
==============================================================================
--- team/murf/bug11210/main/astobj2.c (original)
+++ team/murf/bug11210/main/astobj2.c Mon Mar 3 18:13:23 2008
@@ -176,7 +176,7 @@
*/
-int ao2_ref_debug(void *user_data, const int delta, char *tag, char *file, int line, const char *funcname)
+int _ao2_ref_debug(void *user_data, const int delta, char *tag, char *file, int line, const char *funcname)
{
struct astobj2 *obj = INTERNAL_OBJ(user_data);
@@ -192,7 +192,7 @@
}
-int ao2_ref(void *user_data, const int delta)
+int _ao2_ref(void *user_data, const int delta)
{
struct astobj2 *obj = INTERNAL_OBJ(user_data);
@@ -276,7 +276,7 @@
return EXTERNAL_OBJ(obj);
}
-void *ao2_alloc_debug(size_t data_size, ao2_destructor_fn destructor_fn, char *tag, char *file, int line, const char *funcname)
+void *_ao2_alloc_debug(size_t data_size, ao2_destructor_fn destructor_fn, char *tag, char *file, int line, const char *funcname)
{
/* allocation */
void *obj;
@@ -296,7 +296,7 @@
return obj;
}
-void *ao2_alloc(size_t data_size, ao2_destructor_fn destructor_fn)
+void *_ao2_alloc(size_t data_size, ao2_destructor_fn destructor_fn)
{
return __ao2_alloc(data_size, destructor_fn);
}
@@ -383,26 +383,26 @@
return c;
}
-struct ao2_container *ao2_container_alloc_debug(const uint n_buckets, ao2_hash_fn *hash_fn,
+struct ao2_container *_ao2_container_alloc_debug(const uint n_buckets, ao2_hash_fn *hash_fn,
ao2_callback_fn *cmp_fn, char *tag, char *file, int line, const char *funcname)
{
/* XXX maybe consistency check on arguments ? */
/* compute the container size */
size_t container_size = sizeof(struct ao2_container) + n_buckets * sizeof(struct bucket);
- struct ao2_container *c = ao2_alloc_debug(container_size, container_destruct_debug, tag, file, line, funcname);
+ struct ao2_container *c = _ao2_alloc_debug(container_size, container_destruct_debug, tag, file, line, funcname);
return __ao2_container_alloc(c, n_buckets, hash_fn, cmp_fn);
}
struct ao2_container *
-ao2_container_alloc(const uint n_buckets, ao2_hash_fn *hash_fn,
+_ao2_container_alloc(const uint n_buckets, ao2_hash_fn *hash_fn,
ao2_callback_fn *cmp_fn)
{
/* XXX maybe consistency check on arguments ? */
/* compute the container size */
size_t container_size = sizeof(struct ao2_container) + n_buckets * sizeof(struct bucket);
- struct ao2_container *c = ao2_alloc(container_size, container_destruct);
+ struct ao2_container *c = _ao2_alloc(container_size, container_destruct);
return __ao2_container_alloc(c, n_buckets, hash_fn, cmp_fn);
}
@@ -460,23 +460,23 @@
return p;
}
-void *ao2_link_debug(struct ao2_container *c, void *user_data, char *tag, char *file, int line, const char *funcname)
+void *_ao2_link_debug(struct ao2_container *c, void *user_data, char *tag, char *file, int line, const char *funcname)
{
struct bucket_list *p = __ao2_link(c, user_data);
if (p) {
- ao2_ref_debug(user_data, +1, tag, file, line, funcname);
+ _ao2_ref_debug(user_data, +1, tag, file, line, funcname);
ao2_unlock(c);
}
return p;
}
-void *ao2_link(struct ao2_container *c, void *user_data)
+void *_ao2_link(struct ao2_container *c, void *user_data)
{
struct bucket_list *p = __ao2_link(c, user_data);
if (p) {
- ao2_ref(user_data, +1);
+ _ao2_ref(user_data, +1);
ao2_unlock(c);
}
return p;
@@ -494,23 +494,23 @@
* Unlink an object from the container
* and destroy the associated * ao2_bucket_list structure.
*/
-void *ao2_unlink_debug(struct ao2_container *c, void *user_data, char *tag,
+void *_ao2_unlink_debug(struct ao2_container *c, void *user_data, char *tag,
char *file, int line, const char *funcname)
{
if (INTERNAL_OBJ(user_data) == NULL) /* safety check on the argument */
return NULL;
- ao2_callback_debug(c, OBJ_UNLINK | OBJ_POINTER | OBJ_NODATA, ao2_match_by_addr, user_data, tag, file, line, funcname);
+ _ao2_callback_debug(c, OBJ_UNLINK | OBJ_POINTER | OBJ_NODATA, ao2_match_by_addr, user_data, tag, file, line, funcname);
return NULL;
}
-void *ao2_unlink(struct ao2_container *c, void *user_data)
+void *_ao2_unlink(struct ao2_container *c, void *user_data)
{
if (INTERNAL_OBJ(user_data) == NULL) /* safety check on the argument */
return NULL;
- ao2_callback(c, OBJ_UNLINK | OBJ_POINTER | OBJ_NODATA, ao2_match_by_addr, user_data);
+ _ao2_callback(c, OBJ_UNLINK | OBJ_POINTER | OBJ_NODATA, ao2_match_by_addr, user_data);
return NULL;
}
@@ -590,9 +590,9 @@
/* it is important to handle this case before the unlink */
ret = EXTERNAL_OBJ(cur->astobj);
if (tag)
- ao2_ref_debug(ret, 1, tag, file, line, funcname);
+ _ao2_ref_debug(ret, 1, tag, file, line, funcname);
else
- ao2_ref(ret, 1);
+ _ao2_ref(ret, 1);
}
if (flags & OBJ_UNLINK) { /* must unlink */
@@ -604,9 +604,9 @@
/* update number of elements and version */
ast_atomic_fetchadd_int(&c->elements, -1);
if (tag)
- ao2_ref_debug(EXTERNAL_OBJ(x->astobj), -1, tag, file, line, funcname);
+ _ao2_ref_debug(EXTERNAL_OBJ(x->astobj), -1, tag, file, line, funcname);
else
- ao2_ref(EXTERNAL_OBJ(x->astobj), -1);
+ _ao2_ref(EXTERNAL_OBJ(x->astobj), -1);
free(x); /* free the link record */
}
@@ -630,7 +630,7 @@
return ret;
}
-void *ao2_callback_debug(struct ao2_container *c,
+void *_ao2_callback_debug(struct ao2_container *c,
const enum search_flags flags,
ao2_callback_fn *cb_fn, void *arg,
char *tag, char *file, int line, const char *funcname)
@@ -638,7 +638,7 @@
return __ao2_callback(c,flags, cb_fn, arg, tag, file, line, funcname);
}
-void *ao2_callback(struct ao2_container *c,
+void *_ao2_callback(struct ao2_container *c,
const enum search_flags flags,
ao2_callback_fn *cb_fn, void *arg)
{
@@ -648,14 +648,14 @@
/*!
* the find function just invokes the default callback with some reasonable flags.
*/
-void *ao2_find_debug(struct ao2_container *c, void *arg, enum search_flags flags, char *tag, char *file, int line, const char *funcname)
-{
- return ao2_callback_debug(c, flags, c->cmp_fn, arg, tag, file, line, funcname);
-}
-
-void *ao2_find(struct ao2_container *c, void *arg, enum search_flags flags)
-{
- return ao2_callback(c, flags, c->cmp_fn, arg);
+void *_ao2_find_debug(struct ao2_container *c, void *arg, enum search_flags flags, char *tag, char *file, int line, const char *funcname)
+{
+ return _ao2_callback_debug(c, flags, c->cmp_fn, arg, tag, file, line, funcname);
+}
+
+void *_ao2_find(struct ao2_container *c, void *arg, enum search_flags flags)
+{
+ return _ao2_callback(c, flags, c->cmp_fn, arg);
}
/*!
@@ -729,7 +729,7 @@
return ret;
}
-void * ao2_iterator_next_debug(struct ao2_iterator *a, char *tag, char *file, int line, const char *funcname)
+void * _ao2_iterator_next_debug(struct ao2_iterator *a, char *tag, char *file, int line, const char *funcname)
{
struct bucket_list *p;
void *ret = NULL;
@@ -738,7 +738,7 @@
if (p) {
/* inc refcount of returned object */
- ao2_ref_debug(ret, 1, tag, file, line, funcname);
+ _ao2_ref_debug(ret, 1, tag, file, line, funcname);
}
if (!(a->flags & F_AO2I_DONTLOCK))
@@ -747,7 +747,7 @@
return ret;
}
-void * ao2_iterator_next(struct ao2_iterator *a)
+void * _ao2_iterator_next(struct ao2_iterator *a)
{
struct bucket_list *p = NULL;
void *ret = NULL;
@@ -776,7 +776,7 @@
static int cd_cb_debug(void *obj, void *arg, int flag)
{
- ao2_ref_debug(obj, -1, "deref object via container destroy", __FILE__, __LINE__, __PRETTY_FUNCTION__);
+ _ao2_ref_debug(obj, -1, "deref object via container destroy", __FILE__, __LINE__, __PRETTY_FUNCTION__);
return 0;
}
More information about the asterisk-commits
mailing list