Module: kamailio Branch: master Commit: b6fccea258e56b7d3195659245713a6d44acb013 URL: https://github.com/kamailio/kamailio/commit/b6fccea258e56b7d3195659245713a6d...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2024-03-10T07:43:51+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
---
Modified: src/modules/topos/tps_storage.c
---
Diff: https://github.com/kamailio/kamailio/commit/b6fccea258e56b7d3195659245713a6d... Patch: https://github.com/kamailio/kamailio/commit/b6fccea258e56b7d3195659245713a6d...
---
diff --git a/src/modules/topos/tps_storage.c b/src/modules/topos/tps_storage.c index fc0c2835a33..bb153bb780a 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 == TPS_CONTACT_MODE_RURIUSER || ctmode == TPS_CONTACT_MODE_XAVPUSER) { @@ -283,8 +284,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 == TPS_CONTACT_MODE_RURIUSER || ctmode == TPS_CONTACT_MODE_XAVPUSER) { @@ -296,27 +298,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;