[asterisk-commits] rizzo: branch rizzo/astobj2 r47271 - in /team/rizzo/astobj2: channels/ includ...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Nov 7 10:50:01 MST 2006


Author: rizzo
Date: Tue Nov  7 11:50:01 2006
New Revision: 47271

URL: http://svn.digium.com/view/asterisk?rev=47271&view=rev
Log:
avoid doing p > 0 when p is a pointer;
move a lock closer to the place where it is needed


Modified:
    team/rizzo/astobj2/channels/chan_sip.c
    team/rizzo/astobj2/include/asterisk/astobj2.h

Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?rev=47271&r1=47270&r2=47271&view=diff
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Tue Nov  7 11:50:01 2006
@@ -8642,12 +8642,12 @@
 	arg.fromtag = fromtag;
 	arg.totag = totag;
 
-	dialoglist_lock();
 
 	if (option_debug > 3 && totag)
 		ast_log(LOG_DEBUG, "Looking for callid %s (fromtag %s totag %s)\n", callid, fromtag ? fromtag : "<no fromtag>", totag ? totag : "<no totag>");
 
 	/* Search dialogs and find the match */
+	dialoglist_lock();
 	for (sip_pvt_ptr = dialoglist; sip_pvt_ptr; sip_pvt_ptr = sip_pvt_ptr->next) {
 		if (find_pvt_byid_cb(sip_pvt_ptr, &arg))
 			break;
@@ -15142,7 +15142,7 @@
 		peer->call = NULL;
 		return 0;
 	}
-	if (peer->call > 0) {
+	if (peer->call) {
 		if (sipdebug)
 			ast_log(LOG_NOTICE, "Still have a QUALIFY dialog active, deleting\n");
 		sip_destroy(peer->call);

Modified: team/rizzo/astobj2/include/asterisk/astobj2.h
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/include/asterisk/astobj2.h?rev=47271&r1=47270&r2=47271&view=diff
==============================================================================
--- team/rizzo/astobj2/include/asterisk/astobj2.h (original)
+++ team/rizzo/astobj2/include/asterisk/astobj2.h Tue Nov  7 11:50:01 2006
@@ -61,10 +61,12 @@
     astobj2_ref(o, -1)
 
   causing the destructor to be called (and then memory freed) when
-  the refcount goes to 0.
+  the refcount goes to 0. This is also available as astobj2_unref(o),
+  and returns NULL
 
 - astobj2_ref(o, +1) can be used to modify the refcount on the
   object in case we want to pass it around.
+	
 
 - other calls on the object are astobj2_lock(obj), astobj2_unlock(),
   astobj2_trylock(), to manipulate the lock.



More information about the asterisk-commits mailing list