[Freeswitch-svn] [commit] r9420 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nua

Freeswitch SVN mikej at freeswitch.org
Wed Sep 3 14:29:19 EDT 2008


Author: mikej
Date: Wed Sep  3 14:29:19 2008
New Revision: 9420

Modified:
   freeswitch/trunk/libs/sofia-sip/.update
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h

Log:
Wed Sep  3 13:55:22 EDT 2008  Pekka Pessi <first.last at nokia.com>
  * nua: using HAVE_MEMLEAK_LOG
  
  Logging nua_handle_ref() and nua_handle_unref().



Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update	(original)
+++ freeswitch/trunk/libs/sofia-sip/.update	Wed Sep  3 14:29:19 2008
@@ -1 +1 @@
-Wed Sep  3 14:27:37 EDT 2008
+Wed Sep  3 14:29:03 EDT 2008

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c	Wed Sep  3 14:29:19 2008
@@ -163,8 +163,47 @@
   SU_DEBUG_0(("nh_destructor(%p)\n", (void *)nh));
 }
 
-#undef nua_handle_ref
-#undef nua_handle_unref
+#if HAVE_MEMLEAK_LOG
+
+nua_handle_t *
+_nua_handle_ref_by(nua_handle_t *nh,
+		   char const *file, unsigned line,
+		   char const *function)
+{
+  if (nh)
+    SU_DEBUG_0(("%p - nua_handle_ref() => "MOD_ZU" by %s:%u: %s()\n",
+		nh, su_home_refcount((su_home_t *)nh) + 1, file, line, by));
+  return (nua_handle_t *)su_home_ref((su_home_t *)nh);
+}
+
+int
+_nua_handle_unref_by(nua_handle_t *nh,
+		    char const *file, unsigned line,
+		    char const *function)
+{
+  if (nh) {
+    size_t refcount = su_home_refcount((su_home_t *)nh) - 1;
+    int freed =  su_home_unref((su_home_t *)nh);
+    if (freed) refcount = 0;
+    SU_DEBUG_0(("%p - nua_handle_unref() => "MOD_ZU" by %s:%u: %s()\n",
+		nh, refcount, file, line, by));
+    return freed;
+  }
+
+  return 0;
+}
+
+nua_handle_t *nua_handle_ref(nua_handle_t *nh)
+{
+  return _nua_handle_ref_by(nh, "<app>", 0, "<app>")
+}
+
+int nua_handle_unref(nua_handle_t *nh)
+{
+  return _nua_handle_unref_by(nh, "<app>", 0, "<app>")
+}
+
+#else
 
 /** Make a new reference to handle.
  *
@@ -198,6 +237,8 @@
   return su_home_unref(nh->nh_home);
 }
 
+#endif
+
 /** Generate an instance identifier. */
 char const *nua_generate_instance_identifier(su_home_t *home)
 {

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h	Wed Sep  3 14:29:19 2008
@@ -103,37 +103,6 @@
   TAG_IF((include) && (soa) && soa_is_remote_chat_active(soa) >= 0,	\
 	 SOATAG_ACTIVE_CHAT(soa_is_remote_chat_active(soa)))
 
-#if HAVE_NUA_HANDLE_DEBUG
-
-#define nua_handle_ref(nh) nua_handle_ref_by((nh), __func__)
-#define nua_handle_unref(nh) nua_handle_unref_by((nh), __func__)
-
-su_inline nua_handle_t *nua_handle_ref_by(nua_handle_t *nh,
-					  char const *by)
-{
-  if (nh)
-    SU_DEBUG_0(("nua_handle_ref(%p) => "MOD_ZU" by %s\n", nh, 
-		su_home_refcount((su_home_t *)nh) + 1,
-		by));
-  return (nua_handle_t *)su_home_ref((su_home_t *)nh);
-}
-
-su_inline int nua_handle_unref_by(nua_handle_t *nh, char const *by)
-{
-  if (nh) {
-    size_t refcount = su_home_refcount((su_home_t *)nh) - 1;
-    int freed =  su_home_unref((su_home_t *)nh);
-    if (freed) refcount = 0;
-    SU_DEBUG_0(("nua_handle_unref(%p) => "MOD_ZU" by %s\n",
-		nh, refcount, by));
-    return freed;
-  }
-
-  return 0; 
-}
-
-#endif
-
 /** @internal @brief NUA handle. 
  *
  */
@@ -277,6 +246,20 @@
 #define __func__ "nua"
 #endif
 
+#if HAVE_MEMLEAK_LOG
+
+#define nua_handle_ref(nh) \
+  _nua_handle_ref_by((nh), __FILE__, __LINE__, __func__)
+#define nua_handle_unref(nh) \
+  _nua_handle_unref_by((nh), __FILE__, __LINE__, __func__)
+
+nua_handle_t *_nua_handle_ref_by(
+  nua_handle_t *nh, char const *file, unsigned line, char const *by);
+int _nua_handle_unref_by(
+  nua_handle_t *nh, char const *file, unsigned line, char const *by);
+
+#endif
+
 su_inline nua_t *nua_stack_ref(nua_t *nua)
 { 
   return (nua_t *)su_home_ref(nua->nua_home);



More information about the Freeswitch-svn mailing list