[sr-dev] git:master:e69c3284: sdpops: reuse _strnstr() from core instead of own implementation

Daniel-Constantin Mierla miconda at gmail.com
Tue Mar 15 12:41:15 CET 2016


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-03-15T12:40:47+01:00

sdpops: reuse _strnstr() from core instead of own implementation

---

Modified: modules/sdpops/sdpops_mod.c

---

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

---

diff --git a/modules/sdpops/sdpops_mod.c b/modules/sdpops/sdpops_mod.c
index 9cbd8d6..c3e188f 100644
--- a/modules/sdpops/sdpops_mod.c
+++ b/modules/sdpops/sdpops_mod.c
@@ -1529,31 +1529,6 @@ static int w_sdp_content(sip_msg_t* msg, char* foo, char *bar)
 	return -1;
 }
 
-/*
- * Find the first case insensitive occurrence of find in s, where the
- * search is limited to the first slen characters of s.
- * Based on FreeBSD strnstr.
- */
-char* strnistr(const char *s, const char *find, size_t slen)
-{
-	char c, sc;
-	size_t len;
-
-	if ((c = *find++) != '\0') {
-		len = strlen(find);
-		do {
-			do {
-				if ((sc = *s++) == '\0' || slen-- < 1)
-					return (NULL);
-			} while (sc != c);
-			if (len > slen)
-				return (NULL);
-		} while (strncasecmp(s, find, len) != 0);
-		s--;
-	}
-	return ((char *)s);
-}
-
 /**
  *
  */
@@ -1576,7 +1551,7 @@ static int w_sdp_content_sloppy(sip_msg_t* msg, char* foo, char *bar)
 		if ((mime & 0x00ff) == SUBTYPE_SDP) return 1; else return -1;
 	case TYPE_MULTIPART:
 		if ((mime & 0x00ff) == SUBTYPE_MIXED) {
-			if (strnistr(body.s, "application/sdp", body.len) == NULL) {
+			if (_strnistr(body.s, "application/sdp", body.len) == NULL) {
 				return -1;
 			} else {
 				return 1;




More information about the sr-dev mailing list