Module: kamailio
Branch: master
Commit: 15d81a0151aa46a20f95fb8c6dc2665d03e741aa
URL: 
https://github.com/kamailio/kamailio/commit/15d81a0151aa46a20f95fb8c6dc2665d03e741aa

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2024-09-16T12:18:54+02:00

core: use macro to check send_port_str value

---

Modified: src/core/msg_translator.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/15d81a0151aa46a20f95fb8c6dc2665d03e741aa.diff
Patch: 
https://github.com/kamailio/kamailio/commit/15d81a0151aa46a20f95fb8c6dc2665d03e741aa.patch

---

diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c
index bc68a920ef6..4f88150e11b 100644
--- a/src/core/msg_translator.c
+++ b/src/core/msg_translator.c
@@ -728,7 +728,7 @@ static inline int lumps_len(
                        };                                                      
         \
                        break;                                                  
         \
                case SUBST_SND_PORT:                                            
     \
-                       if(send_port_str != NULL) {                             
         \
+                       if(STR_WITHVAL(send_port_str)) {                        
         \
                                new_len += send_port_str->len;                  
             \
                        } else {                                                
         \
                                LM_CRIT("null send sock port\n");               
             \
@@ -772,7 +772,7 @@ static inline int lumps_len(
                                                                        
send_address_str->len)                   \
                                                                != NULL))       
                             \
                                        new_len += 2;                           
                 \
-                               if(send_port_str != NULL) {                     
             \
+                               if(STR_WITHVAL(send_port_str)) {                
             \
                                        /* add :port_no */                      
                 \
                                        new_len += 1 + send_port_str->len;      
                 \
                                }                                               
             \
@@ -1175,7 +1175,7 @@ void process_lumps(struct sip_msg *msg, struct lump 
*lumps, char *new_buf,
                        };                                                      
           \
                        break;                                                  
           \
                case SUBST_SND_PORT:                                            
       \
-                       if(send_port_str != NULL) {                             
           \
+                       if(STR_WITHVAL(send_port_str)) {                        
           \
                                memcpy(new_buf + offset, send_port_str->s,      
               \
                                                send_port_str->len);            
                       \
                                offset += send_port_str->len;                   
               \
@@ -1205,7 +1205,7 @@ void process_lumps(struct sip_msg *msg, struct lump 
*lumps, char *new_buf,
                                        offset++;                               
                   \
                                }                                               
               \
                                /* :port */                                     
               \
-                               if(send_port_str != NULL) {                     
               \
+                               if(STR_WITHVAL(send_port_str)) {                
               \
                                        new_buf[offset] = ':';                  
                   \
                                        offset++;                               
                   \
                                        memcpy(new_buf + offset, 
send_port_str->s,                 \

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org

Reply via email to