[sr-dev] git:master:b0d7cef1: call_control: remove redundant str trim implementation and use the one from core

Henning Westerholt hw at skalatan.de
Sat Nov 23 23:23:36 CET 2019


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

Author: Henning Westerholt <hw at skalatan.de>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2019-11-23T23:19:32+01:00

call_control: remove redundant str trim implementation and use the one from core

---

Modified: src/modules/call_control/call_control.c

---

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

---

diff --git a/src/modules/call_control/call_control.c b/src/modules/call_control/call_control.c
index 75179c73dc..98de64523d 100644
--- a/src/modules/call_control/call_control.c
+++ b/src/modules/call_control/call_control.c
@@ -40,6 +40,7 @@
 #include "../../core/str.h"
 #include "../../core/pvar.h"
 #include "../../core/ut.h"
+#include "../../core/trim.h"
 #include "../../core/script_cb.h"
 #include "../../core/parser/digest/digest.h"
 #include "../../core/parser/parse_from.h"
@@ -351,41 +352,6 @@ parse_param_stop(unsigned int type, void *val) {
 }
 
 
-// Functions dealing with strings
-//
-
-// returns string with whitespace trimmed from left end
-static inline void
-ltrim(str *string)
-{
-    while (string->len>0 && isspace((int)*(string->s))) {
-        string->len--;
-        string->s++;
-    }
-}
-
-// returns string with whitespace trimmed from right end
-static inline void
-rtrim(str *string)
-{
-    char *ptr;
-
-    ptr = string->s + string->len - 1;
-    while (string->len>0 && (*ptr==0 || isspace((int)*ptr))) {
-        string->len--;
-        ptr--;
-    }
-}
-
-// returns string with whitespace trimmed from both ends
-static inline void
-trim(str *string)
-{
-    ltrim(string);
-    rtrim(string);
-}
-
-
 // Message checking and parsing
 //
 




More information about the sr-dev mailing list