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

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


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

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

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

---

Modified: src/modules/mediaproxy/mediaproxy.c

---

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

---

diff --git a/src/modules/mediaproxy/mediaproxy.c b/src/modules/mediaproxy/mediaproxy.c
index 29ceca4d3f..c2a22f0007 100644
--- a/src/modules/mediaproxy/mediaproxy.c
+++ b/src/modules/mediaproxy/mediaproxy.c
@@ -41,6 +41,7 @@
 #include "../../core/data_lump.h"
 #include "../../core/mem/mem.h"
 #include "../../core/ut.h"
+#include "../../core/trim.h"
 #include "../../core/parser/msg_parser.h"
 #include "../../core/parser/parse_from.h"
 #include "../../core/parser/parse_to.h"
@@ -289,33 +290,6 @@ static void *strcasefind(
 	return NULL;
 }
 
-// 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);
-}
 
 // returns a pointer to first CR or LF char found or the end of string
 static char *findendline(char *string, int len)




More information about the sr-dev mailing list