Module: kamailio
Branch: 5.7
Commit: 0f31190eb15b1e1244f478cc9538bf071317cb35
URL:
https://github.com/kamailio/kamailio/commit/0f31190eb15b1e1244f478cc9538bf0…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-03-14T10:02:24+01:00
topos: small rearangement by removing else after return in the true block
- reduce level of indentation
- a few wraps in curly braces for clearer view of the if block
(cherry picked from commit b6fccea258e56b7d3195659245713a6d44acb013)
(cherry picked from commit 772b464552cff0b9ebb769e57fae718c0357ba11)
---
Modified: src/modules/topos/tps_storage.c
---
Diff:
https://github.com/kamailio/kamailio/commit/0f31190eb15b1e1244f478cc9538bf0…
Patch:
https://github.com/kamailio/kamailio/commit/0f31190eb15b1e1244f478cc9538bf0…
---
diff --git a/src/modules/topos/tps_storage.c b/src/modules/topos/tps_storage.c
index 70c003c944c..1399017cf77 100644
--- a/src/modules/topos/tps_storage.c
+++ b/src/modules/topos/tps_storage.c
@@ -241,8 +241,9 @@ int tps_storage_fill_contact(
}
contact_len = sv.len;
- if(_tps_contact_host.len)
+ if(_tps_contact_host.len) {
contact_len = sv.len - puri.host.len + _tps_contact_host.len;
+ }
if(ctmode == 1 || ctmode == 2) {
cparam_len = _tps_cparam_name.len;
@@ -282,8 +283,9 @@ int tps_storage_fill_contact(
for(i = 0; i < sv.len; i++) {
*td->cp = sv.s[i];
td->cp++;
- if(sv.s[i] == ':')
+ if(sv.s[i] == ':') {
break;
+ }
}
if(ctmode == 1 || ctmode == 2) {
/* create new URI parameter for Contact header */
@@ -294,27 +296,24 @@ int tps_storage_fill_contact(
|| msg->contact == NULL) {
LM_WARN("bad sip message or missing Contact hdr\n");
return -1;
- } else {
- if(parse_contact(msg->contact) < 0
- || ((contact_body_t *)msg->contact->parsed)
- ->contacts
- == NULL
- || ((contact_body_t *)msg->contact->parsed)
- ->contacts->next
- != NULL) {
- LM_ERR("bad Contact header\n");
- return -1;
- } else {
- if(parse_uri(((contact_body_t *)msg->contact->parsed)
- ->contacts->uri.s,
- ((contact_body_t *)msg->contact->parsed)
- ->contacts->uri.len,
- &curi)
- < 0) {
- LM_ERR("failed to parse the contact uri\n");
- return -1;
- }
- }
+ }
+ if(parse_contact(msg->contact) < 0
+ || ((contact_body_t *)msg->contact->parsed)->contacts
+ == NULL
+ || ((contact_body_t *)msg->contact->parsed)
+ ->contacts->next
+ != NULL) {
+ LM_ERR("bad Contact header\n");
+ return -1;
+ }
+ if(parse_uri(((contact_body_t *)msg->contact->parsed)
+ ->contacts->uri.s,
+ ((contact_body_t *)msg->contact->parsed)
+ ->contacts->uri.len,
+ &curi)
+ < 0) {
+ LM_ERR("failed to parse the contact uri\n");
+ return -1;
}
memcpy(td->cp, curi.user.s, curi.user.len);
td->cp += curi.user.len;