[svn-commits] rizzo: branch rizzo/astobj2 r47873 - /team/rizzo/astobj2/channels/chan_sip.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Nov 21 00:40:54 MST 2006


Author: rizzo
Date: Tue Nov 21 01:40:54 2006
New Revision: 47873

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47873
Log:
remove useless checks for a non-null authpeer


Modified:
    team/rizzo/astobj2/channels/chan_sip.c

Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=47873&r1=47872&r2=47873
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Tue Nov 21 01:40:54 2006
@@ -14632,17 +14632,13 @@
 		return 0;
 	}
 
-	/* \todo At this point, i believe (but not 100% sure) that
-	 * authpeer cannot be NULL. If that is the case, we should remove
-	 * all those checks for authpeer == NULL as they reduce readability.
-	 */
+	/* At this point, authpeer cannot be NULL. */
 
 	/* Check if this user/peer is allowed to subscribe at all */
 	if (!ast_test_flag(&p->flags[1], SIP_PAGE2_ALLOWSUBSCRIBE)) {
 		transmit_response(p, "403 Forbidden (policy)", req);
 		set_destroy(p);
-		if (authpeer)
-			unref_peer(authpeer);
+		unref_peer(authpeer);
 		return 0;
 	}
 
@@ -14663,8 +14659,7 @@
 	if (gotdest) {
 		transmit_response(p, "404 Not Found", req);
 		set_destroy(p);
-		if (authpeer)
-			unref_peer(authpeer);
+		unref_peer(authpeer);
 		return 0;
 	}
 
@@ -14673,8 +14668,8 @@
 		make_our_tag(p->tag, sizeof(p->tag));
 
 	if (!strcmp(event, "presence") || !strcmp(event, "dialog")) { /* Presence, RFC 3842 */
-		if (authpeer)	/* We do not need the authpeer any more */
-			unref_peer(authpeer);
+		/* We do not need the authpeer any more */
+		unref_peer(authpeer);
 
 		/* Header from Xten Eye-beam Accept: multipart/related, application/rlmi+xml, application/pidf+xml, application/xpidf+xml */
 		/* Polycom phones only handle xpidf+xml, even if they say they can
@@ -14704,8 +14699,7 @@
 				ast_log(LOG_DEBUG, "Received SIP mailbox subscription for unknown format: %s\n", accept);
 			transmit_response(p, "406 Not Acceptable", req);
 			set_destroy(p);
-			if (authpeer)
-				unref_peer(authpeer);
+			unref_peer(authpeer);
 			return 0;
 		}
 		/* Looks like they actually want a mailbox status 
@@ -14713,13 +14707,11 @@
 		  The subscribed URI needs to exist in the dial plan
 		  In most devices, this is configurable to the voicemailmain extension you use
 		*/
-		if (!authpeer || ast_strlen_zero(authpeer->mailbox)) {
-			ast_log(LOG_NOTICE, "Received SIP subscribe for peer without mailbox: %s\n",
-				authpeer ? authpeer->name : "(no peer)");
+		if (ast_strlen_zero(authpeer->mailbox)) {
+			ast_log(LOG_NOTICE, "Received SIP subscribe for peer without mailbox: %s\n", authpeer->name);
 			transmit_response(p, "404 Not found (no mailbox)", req);
 			set_destroy(p);
-			if (authpeer)
-				unref_peer(authpeer);
+			unref_peer(authpeer);
 			return 0;
 		}
 
@@ -14739,8 +14731,7 @@
 			ast_log(LOG_DEBUG, "Received SIP subscribe for unknown event package: %s\n", event);
 		transmit_response(p, "489 Bad Event", req);
 		set_destroy(p);
-		if (authpeer)
-			unref_peer(authpeer);
+		unref_peer(authpeer);
 		return 0;
 	}
 



More information about the svn-commits mailing list