[asterisk-commits] eliel: branch eliel/data_retrieval r192068 - in /team/eliel/data_retrieval: ....

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 4 11:48:10 CDT 2009


Author: eliel
Date: Mon May  4 11:48:05 2009
New Revision: 192068

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=192068
Log:
Merged revisions 192032,192059 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r192032 | eliel | 2009-05-04 11:35:35 -0400 (Mon, 04 May 2009) | 3 lines
  
  Do not re-define _POSIX_C_SOURCE if it was already defined.
........
  r192059 | kpfleming | 2009-05-04 12:24:16 -0400 (Mon, 04 May 2009) | 5 lines
  
  Ensure that astobj2 memory allocations are properly accounted for when MALLOC_DEBUG is used
  
  This commit ensures that all astobj2 allocated objects are properly accounted for in MALLOC_DEBUG mode by passing down the file/function/line information from the module/function that actually called the astobj2 allocation function.
........

Modified:
    team/eliel/data_retrieval/   (props changed)
    team/eliel/data_retrieval/include/asterisk/astobj2.h
    team/eliel/data_retrieval/main/astobj2.c
    team/eliel/data_retrieval/main/xml.c

Propchange: team/eliel/data_retrieval/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/eliel/data_retrieval/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon May  4 11:48:05 2009
@@ -1,1 +1,1 @@
-/trunk:1-192001
+/trunk:1-192067

Modified: team/eliel/data_retrieval/include/asterisk/astobj2.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/eliel/data_retrieval/include/asterisk/astobj2.h?view=diff&rev=192068&r1=192067&r2=192068
==============================================================================
--- team/eliel/data_retrieval/include/asterisk/astobj2.h (original)
+++ team/eliel/data_retrieval/include/asterisk/astobj2.h Mon May  4 11:48:05 2009
@@ -402,8 +402,7 @@
  * @{
  */
 
-#ifdef REF_DEBUG
-
+#if defined(REF_DEBUG) || defined(__AST_DEBUG_MALLOC)
 
 #define ao2_t_alloc(data_size, destructor_fn, debug_msg) __ao2_alloc_debug((data_size), (destructor_fn), (debug_msg),  __FILE__, __LINE__, __PRETTY_FUNCTION__)
 #define ao2_alloc(data_size, destructor_fn)              __ao2_alloc_debug((data_size), (destructor_fn), "",  __FILE__, __LINE__, __PRETTY_FUNCTION__)
@@ -414,8 +413,10 @@
 #define ao2_alloc(data_size, destructor_fn)              __ao2_alloc((data_size), (destructor_fn))
 
 #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);
+
 /*! @} */
 
 /*! \brief
@@ -442,14 +443,20 @@
  */
 
 #ifdef REF_DEBUG
+
 #define ao2_t_ref(o,delta,tag) __ao2_ref_debug((o), (delta), (tag),  __FILE__, __LINE__, __PRETTY_FUNCTION__)
 #define ao2_ref(o,delta)       __ao2_ref_debug((o), (delta), "",  __FILE__, __LINE__, __PRETTY_FUNCTION__)
-#else
+
+#else
+
 #define ao2_t_ref(o,delta,tag) __ao2_ref((o), (delta))
 #define ao2_ref(o,delta)       __ao2_ref((o), (delta))
-#endif
+
+#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);
+
 /*! @} */
 
 /*! \brief
@@ -691,23 +698,29 @@
  * destructor is set implicitly.
  */
 
-#ifdef REF_DEBUG
+#if defined(REF_DEBUG) || defined(__AST_DEBUG_MALLOC)
+
 #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
+
+#else
+
 #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
+
+#endif
+
 struct ao2_container *__ao2_container_alloc(const unsigned int n_buckets,
-										  ao2_hash_fn *hash_fn, ao2_callback_fn *cmp_fn);
+					    ao2_hash_fn *hash_fn, ao2_callback_fn *cmp_fn);
 struct ao2_container *__ao2_container_alloc_debug(const unsigned int n_buckets,
-												ao2_hash_fn *hash_fn, ao2_callback_fn *cmp_fn,
-												char *tag, char *file, int line, const char *funcname);
+						  ao2_hash_fn *hash_fn, ao2_callback_fn *cmp_fn,
+						  char *tag, char *file, int line, const char *funcname);
 
 /*! \brief
  * Returns the number of elements in a container.
  */
 int ao2_container_count(struct ao2_container *c);
+
 /*@} */
 
 /*! \name Object Management
@@ -738,15 +751,19 @@
 
 #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
+
+#else
+
 #define ao2_t_link(arg1, arg2, arg3) __ao2_link((arg1), (arg2))
 #define ao2_link(arg1, arg2)         __ao2_link((arg1), (arg2))
-#endif
+
+#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);
 
 /*!
- * \brief Remove an object from the container
+ * \brief Remove an object from a container
  *
  * \param c the container
  * \param obj the object to unlink
@@ -762,12 +779,17 @@
  *       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_unlink(arg1, arg2)         __ao2_unlink_debug((arg1), (arg2), "",  __FILE__, __LINE__, __PRETTY_FUNCTION__)
-#else
+
+#else
+
 #define ao2_t_unlink(arg1, arg2, arg3) __ao2_unlink((arg1), (arg2))
 #define ao2_unlink(arg1, arg2)         __ao2_unlink((arg1), (arg2))
-#endif
+
+#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);
 
@@ -777,6 +799,7 @@
 	struct ao2_list *next;
 	void *obj;	/* pointer to the user portion of the object */
 };
+
 /*@} */
 
 /*! \brief
@@ -859,18 +882,21 @@
  * @{
  */
 #ifdef REF_DEBUG
+
 #define ao2_t_callback(c,flags,cb_fn,arg,tag) __ao2_callback_debug((c), (flags), (cb_fn), (arg), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__)
 #define ao2_callback(c,flags,cb_fn,arg)       __ao2_callback_debug((c), (flags), (cb_fn), (arg), "", __FILE__, __LINE__, __PRETTY_FUNCTION__)
-#else
+
+#else
+
 #define ao2_t_callback(c,flags,cb_fn,arg,tag) __ao2_callback((c), (flags), (cb_fn), (arg))
 #define ao2_callback(c,flags,cb_fn,arg)       __ao2_callback((c), (flags), (cb_fn), (arg))
-#endif
-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,
-					enum search_flags flags,
-					ao2_callback_fn *cb_fn, void *arg);
+
+#endif
+
+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, enum search_flags flags, ao2_callback_fn *cb_fn, void *arg);
+
 /*! @} */
 
 /*! \brief
@@ -889,30 +915,40 @@
  * \see ao2_callback()
  */
 #ifdef REF_DEBUG
+
 #define ao2_t_callback_data(arg1,arg2,arg3,arg4,arg5,arg6) __ao2_callback_data_debug((arg1), (arg2), (arg3), (arg4), (arg5), (arg6), __FILE__, __LINE__, __PRETTY_FUNCTION__)
 #define ao2_callback_data(arg1,arg2,arg3,arg4,arg5)        __ao2_callback_data_debug((arg1), (arg2), (arg3), (arg4), (arg5), "", __FILE__, __LINE__, __PRETTY_FUNCTION__)
-#else
+
+#else
+
 #define ao2_t_callback_data(arg1,arg2,arg3,arg4,arg5,arg6) __ao2_callback_data((arg1), (arg2), (arg3), (arg4), (arg5))
 #define ao2_callback_data(arg1,arg2,arg3,arg4,arg5)        __ao2_callback_data((arg1), (arg2), (arg3), (arg4), (arg5))
-#endif
+
+#endif
+
 void *__ao2_callback_data_debug(struct ao2_container *c, enum search_flags flags,
-						  ao2_callback_data_fn *cb_fn, void *arg, void *data, char *tag,
-						  char *file, int line, const char *funcname);
-void *__ao2_callback_data(struct ao2_container *c,
-					enum search_flags flags,
-					ao2_callback_data_fn *cb_fn, void *arg, void *data);
+				ao2_callback_data_fn *cb_fn, void *arg, void *data, char *tag,
+				char *file, int line, const char *funcname);
+void *__ao2_callback_data(struct ao2_container *c, enum search_flags flags,
+			  ao2_callback_data_fn *cb_fn, void *arg, void *data);
 
 /*! ao2_find() is a short hand for ao2_callback(c, flags, c->cmp_fn, arg)
  * 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_find(arg1,arg2,arg3)        __ao2_find_debug((arg1), (arg2), (arg3), "", __FILE__, __LINE__, __PRETTY_FUNCTION__)
-#else
+
+#else
+
 #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);
+
+#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);
 
 /*! \brief
@@ -1011,16 +1047,23 @@
    searches for the next pointer */
 
 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_iterator_next(arg1)         __ao2_iterator_next_debug((arg1), "",  __FILE__, __LINE__, __PRETTY_FUNCTION__)
-#else
+
+#else
+
 #define ao2_t_iterator_next(arg1, arg2) __ao2_iterator_next((arg1))
 #define ao2_iterator_next(arg1)         __ao2_iterator_next((arg1))
-#endif
+
+#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);
 
 /* extra functions */
 void ao2_bt(void);	/* backtrace */
+
 #endif /* _ASTERISK_ASTOBJ2_H */

Modified: team/eliel/data_retrieval/main/astobj2.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/eliel/data_retrieval/main/astobj2.c?view=diff&rev=192068&r1=192067&r2=192068
==============================================================================
--- team/eliel/data_retrieval/main/astobj2.c (original)
+++ team/eliel/data_retrieval/main/astobj2.c Mon May  4 11:48:05 2009
@@ -135,7 +135,6 @@
 /* the underlying functions common to debug and non-debug versions */
 
 static int internal_ao2_ref(void *user_data, const int delta);
-static void *internal_ao2_alloc(size_t data_size, ao2_destructor_fn destructor_fn);
 static struct ao2_container *internal_ao2_container_alloc(struct ao2_container *c, const uint n_buckets, ao2_hash_fn *hash_fn,
 							  ao2_callback_fn *cmp_fn);
 static struct bucket_list *internal_ao2_link(struct ao2_container *c, void *user_data, const char *file, int line, const char *func);
@@ -303,7 +302,7 @@
  * We always alloc at least the size of a void *,
  * for debugging purposes.
  */
-static void *internal_ao2_alloc(size_t data_size, ao2_destructor_fn destructor_fn)
+static void *internal_ao2_alloc(size_t data_size, ao2_destructor_fn destructor_fn, char *file, int line, const char *funcname)
 {
 	/* allocation */
 	struct astobj2 *obj;
@@ -311,7 +310,11 @@
 	if (data_size < sizeof(void *))
 		data_size = sizeof(void *);
 
+#if defined(__AST_DEBUG_MALLOC)
+	obj = __ast_calloc(1, sizeof(*obj) + data_size, file, line, funcname);
+#else
 	obj = ast_calloc(1, sizeof(*obj) + data_size);
+#endif
 
 	if (obj == NULL)
 		return NULL;
@@ -338,7 +341,7 @@
 	void *obj;
 	FILE *refo = fopen(REF_FILE,"a");
 
-	obj = internal_ao2_alloc(data_size, destructor_fn);
+	obj = internal_ao2_alloc(data_size, destructor_fn, file, line, funcname);
 
 	if (obj == NULL)
 		return NULL;
@@ -354,7 +357,7 @@
 
 void *__ao2_alloc(size_t data_size, ao2_destructor_fn destructor_fn)
 {
-	return internal_ao2_alloc(data_size, destructor_fn);
+	return internal_ao2_alloc(data_size, destructor_fn, NULL, 0, NULL);
 }
 
 

Modified: team/eliel/data_retrieval/main/xml.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/eliel/data_retrieval/main/xml.c?view=diff&rev=192068&r1=192067&r2=192068
==============================================================================
--- team/eliel/data_retrieval/main/xml.c (original)
+++ team/eliel/data_retrieval/main/xml.c Mon May  4 11:48:05 2009
@@ -27,9 +27,6 @@
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #if defined(HAVE_LIBXML2)
-#ifndef _POSIX_C_SOURCE
-#define _POSIX_C_SOURCE	200112L
-#endif
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 /* libxml2 ast_xml implementation. */




More information about the asterisk-commits mailing list