[sr-dev] git:master:4d89a505: tm: avoiding conditional directives that split up parts of statements

Daniel-Constantin Mierla miconda at gmail.com
Mon Dec 14 15:17:22 CET 2015


Module: kamailio
Branch: master
Commit: 4d89a50544324fdac0f08497dc142c171bfcd97d
URL: https://github.com/kamailio/kamailio/commit/4d89a50544324fdac0f08497dc142c171bfcd97d

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-12-14T15:15:52+01:00

tm: avoiding conditional directives that split up parts of statements

- patch by Romero Malaquias, FS#434

---

Modified: modules/tm/t_fwd.c

---

Diff:  https://github.com/kamailio/kamailio/commit/4d89a50544324fdac0f08497dc142c171bfcd97d.diff
Patch: https://github.com/kamailio/kamailio/commit/4d89a50544324fdac0f08497dc142c171bfcd97d.patch

---

diff --git a/modules/tm/t_fwd.c b/modules/tm/t_fwd.c
index 9cd002f..15f0969 100644
--- a/modules/tm/t_fwd.c
+++ b/modules/tm/t_fwd.c
@@ -146,6 +146,7 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
 	str ua_bak;
 	int free_ua;
 	int backup_route_type;
+	int test_dst;
 	snd_flags_t fwd_snd_flags_bak;
 	snd_flags_t rpl_snd_flags_bak;
 	struct socket_info *force_send_socket_bak;
@@ -427,14 +428,14 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
 	if (likely(next_hop!=0 || (flags & UAC_DNS_FAILOVER_F))){
 		/* next_hop present => use it for dns resolution */
 #ifdef USE_DNS_FAILOVER
-		if (uri2dst2(&t->uac[branch].dns_h, dst, fsocket, snd_flags,
-							next_hop?next_hop:uri, fproto) == 0)
+		test_dst = (uri2dst2(&t->uac[branch].dns_h, dst, fsocket, snd_flags,
+							next_hop?next_hop:uri, fproto) == 0);
 #else
 		/* dst filled from the uri & request (send_socket) */
-		if (uri2dst2(dst, fsocket, snd_flags,
-							next_hop?next_hop:uri, fproto)==0)
+		test_dst = (uri2dst2(dst, fsocket, snd_flags,
+							next_hop?next_hop:uri, fproto)==0);
 #endif
-		{
+		if (test_dst){
 			ret=E_BAD_ADDRESS;
 			goto error01;
 		}




More information about the sr-dev mailing list