[Freeswitch-svn] [commit] r11806 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/sip libsofia-sip-ua/sip/sofia-sip

FreeSWITCH SVN mikej at freeswitch.org
Wed Feb 11 08:52:15 PST 2009


Author: mikej
Date: Wed Feb 11 10:52:15 2009
New Revision: 11806

Log:
Thu Jan  8 15:13:56 CST 2009  Pekka Pessi <first.last at nokia.com>
  * sip: using <sofia-sip/su_string.h> functions



Modified:
   freeswitch/trunk/libs/sofia-sip/.update
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_basic.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_caller_prefs.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_event.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_extra.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_feature.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_parser.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_pref_util.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_reason.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_refer.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_security.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_session.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_tag_class.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_parser.h
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/test_date.c

Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update	(original)
+++ freeswitch/trunk/libs/sofia-sip/.update	Wed Feb 11 10:52:15 2009
@@ -1 +1 @@
-Wed Feb 11 10:51:28 CST 2009
+Wed Feb 11 10:52:05 CST 2009

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_basic.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_basic.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_basic.c	Wed Feb 11 10:52:15 2009
@@ -41,7 +41,7 @@
 #define MSG_HDR_T       union sip_header_u
 
 #include <sofia-sip/su_alloc.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 
 #include "sofia-sip/sip_parser.h"
 #include <sofia-sip/sip_util.h>
@@ -940,7 +940,7 @@
   if (name == NULL) {
     a->a_tag = NULL;
   }
-  else if (namelen == strlen("tag") && !strncasecmp(name, "tag", namelen)) {
+  else if (namelen == strlen("tag") && su_casenmatch(name, "tag", namelen)) {
     a->a_tag = value;
   }
 
@@ -983,7 +983,7 @@
       value = tag;
 
     if (a->a_tag) {
-      if (strcasecmp(a->a_tag, value) == 0)
+      if (su_casematch(a->a_tag, value))
 	return 0;
       else
 	return -1;
@@ -1456,12 +1456,12 @@
     m->m_q = NULL;
     m->m_expires = NULL;
   }
-  else if (namelen == 1 && strncasecmp(name, "q", 1) == 0) {
+  else if (namelen == 1 && su_casenmatch(name, "q", 1)) {
     /* XXX - check for invalid value? */
     m->m_q = value;
   }
   else if (namelen == strlen("expires") &&
-	   !strncasecmp(name, "expires", namelen)) {
+	   su_casenmatch(name, "expires", namelen)) {
     m->m_expires = value;
   }
 
@@ -2086,7 +2086,7 @@
     af->af_duration = NULL;
   }
   else if (namelen == strlen("duration") &&
-	   !strncasecmp(name, "duration", namelen)) {
+	   su_casenmatch(name, "duration", namelen)) {
     af->af_duration = value;
   }
 
@@ -2635,7 +2635,7 @@
     v->v_rport = NULL;
     v->v_comp = NULL;
   }
-#define MATCH(s) (namelen == strlen(#s) && !strncasecmp(name, #s, strlen(#s)))
+#define MATCH(s) (namelen == strlen(#s) && su_casenmatch(name, #s, strlen(#s)))
 
    else if (MATCH(ttl)) {
      v->v_ttl = value;
@@ -2761,7 +2761,7 @@
 
     if (v->v_rport && !v->v_maddr /* multicast */) {
       if (v->v_protocol == sip_transport_udp ||
-	  strcasecmp(v->v_protocol, sip_transport_udp) == 0)
+	  su_casematch(v->v_protocol, sip_transport_udp))
 	port = v->v_rport, *using_rport = 0;
       else if (*using_rport)
 	port = v->v_rport;

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_caller_prefs.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_caller_prefs.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_caller_prefs.c	Wed Feb 11 10:52:15 2009
@@ -205,7 +205,7 @@
     *s = '\0', s += span_lws(s + 1) + 1;
 
   /* Kludge: support PoC IS spec with a typo... */
-  if (strncasecmp(s, "*,", 2) == 0)
+  if (su_casenmatch(s, "*,", 2))
     s[1] = ';',  kludge = 0;
   else if (s[0] != '*' && s[0] != '<') {
     /* Kludge: missing URL -  */
@@ -346,7 +346,7 @@
     cp->cp_require = 0;
     cp->cp_explicit = 0;
   }
-#define MATCH(s) (namelen == strlen(#s) && !strncasecmp(name, #s, strlen(#s)))
+#define MATCH(s) (namelen == strlen(#s) && su_casenmatch(name, #s, strlen(#s)))
 
 #if nomore
   else if (MATCH(q)) {

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_event.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_event.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_event.c	Wed Feb 11 10:52:15 2009
@@ -159,7 +159,7 @@
   if (name == NULL) {
     o->o_id = NULL;
   }
-  else if (namelen == strlen("id") && !strncasecmp(name, "id", namelen)) {
+  else if (namelen == strlen("id") && su_casenmatch(name, "id", namelen)) {
     o->o_id = value;
   }
 
@@ -373,7 +373,7 @@
     ss->ss_retry_after = NULL;
     ss->ss_expires = NULL;
   }
-#define MATCH(s) (namelen == strlen(#s) && !strncasecmp(name, #s, strlen(#s)))
+#define MATCH(s) (namelen == strlen(#s) && su_casenmatch(name, #s, strlen(#s)))
 
   else if (MATCH(reason)) {
     ss->ss_reason = value;
@@ -498,9 +498,9 @@
 
   if (pub->pub_params)
     for (i = 0; pub->pub_params[i]; i++) {
-      if (strncasecmp(pub->pub_params[i], "stream=", strlen("stream=")) == 0)
+      if (su_casenmatch(pub->pub_params[i], "stream=", strlen("stream=")))
 	pub->pub_stream = pub->pub_params[i] + strlen("stream=");
-      else if (strncasecmp(pub->pub_params[i], "type=", strlen("type=")) == 0)
+      else if (su_casenmatch(pub->pub_params[i], "type=", strlen("type=")))
 	pub->pub_type = pub->pub_params[i] + strlen("type=");
     }
 }

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_extra.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_extra.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_extra.c	Wed Feb 11 10:52:15 2009
@@ -132,10 +132,10 @@
  * Update parameter in a @CallInfo object.
  *
  */
-static
-int sip_call_info_update(msg_common_t *h,
-			  char const *name, isize_t namelen,
-			  char const *value)
+static int
+sip_call_info_update(msg_common_t *h,
+		     char const *name, isize_t namelen,
+		     char const *value)
 {
   sip_call_info_t *ci = (sip_call_info_t *)h;
 
@@ -143,7 +143,7 @@
     ci->ci_purpose = NULL;
   }
   else if (namelen == strlen("purpose") &&
-	   !strncasecmp(name, "purpose", namelen)) {
+	   su_casenmatch(name, "purpose", namelen)) {
     ci->ci_purpose = value;
   }
 
@@ -1213,7 +1213,7 @@
     rpid->rpid_privacy = NULL;
   }
 
-#define MATCH(s) (namelen == strlen(#s) && !strncasecmp(name, #s, strlen(#s)))
+#define MATCH(s) (namelen == strlen(#s) && su_casenmatch(name, #s, strlen(#s)))
 
   else if (MATCH(screen))
     rpid->rpid_screen = value;

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_feature.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_feature.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_feature.c	Wed Feb 11 10:52:15 2009
@@ -425,21 +425,21 @@
       msg_param_t feature = require->k_items[i++];
 
       for (j = 0; slist[j]; j++)
-	if (strcasecmp(feature, slist[j]) == 0) {
+	if (su_casematch(feature, slist[j])) {
 	  feature = NULL;
 	  break;
 	}
 
       if (feature)
 	for (j = 0; rlist[j]; j++)
-	  if (strcasecmp(feature, rlist[j]) == 0) {
+	  if (su_casematch(feature, rlist[j])) {
 	    feature = NULL;
 	    break;
 	  }
 
       if (feature)
 	for (j = 0; prlist[j]; j++)
-	  if (strcasecmp(feature, prlist[j]) == 0) {
+	  if (su_casematch(feature, prlist[j])) {
 	    feature = NULL;
 	    break;
 	  }
@@ -478,7 +478,7 @@
   for (; supported; supported = supported->k_next)
     if (supported->k_items)
       for (i = 0; supported->k_items[i]; i++)
-	if (strcasecmp(feature, supported->k_items[i]) == 0)
+	if (su_casematch(feature, supported->k_items[i]))
 	  return 1;
 
   return 0;

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_parser.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_parser.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_parser.c	Wed Feb 11 10:52:15 2009
@@ -39,6 +39,7 @@
 #define MSG_HDR_T       union sip_header_u
 
 #include <sofia-sip/su_tagarg.h>
+#include <sofia-sip/su_string.h>
 #include "sofia-sip/sip_parser.h"
 #include <sofia-sip/msg_mclass.h>
 
@@ -231,7 +232,7 @@
   char const *result;
   size_t const version_size = sizeof(sip_version_2_0) - 1;
 
-  if (strncasecmp(s, sip_version_2_0, version_size) == 0 &&
+  if (su_casenmatch(s, sip_version_2_0, version_size) &&
       !IS_TOKEN(s[version_size])) {
     result = sip_version_2_0;
     s += version_size;
@@ -260,7 +261,7 @@
       s[l1 + 1 + l2] = 0;
 
       /* Compare again with compacted version */
-      if (strcasecmp(s, sip_version_2_0) == 0)
+      if (su_casematch(s, sip_version_2_0))
 	result = sip_version_2_0;
     }
 
@@ -459,10 +460,10 @@
   char *s = *ss;
 
 #define TRANSPORT_MATCH(t)					     \
-  (strncasecmp(s+7, t+7, sizeof(t)-8) == 0 && (IS_LWS(s[sizeof(t)])) \
+  (su_casenmatch(s + 7, t + 7, (sizeof t) - 8) && (IS_LWS(s[sizeof(t)])) \
    && (transport = t, s += sizeof(t) - 1))
 
-  if (strncasecmp(s, "SIP/2.0", 7) != 0 ||
+  if (!su_casenmatch(s, "SIP/2.0", 7) ||
       (!TRANSPORT_MATCH(sip_transport_udp) &&
        !TRANSPORT_MATCH(sip_transport_tcp) &&
        !TRANSPORT_MATCH(sip_transport_sctp) &&
@@ -502,13 +503,13 @@
       pt[pt_len] = '\0';
 
       /* extra whitespace? */
-      if (!strcasecmp(transport, sip_transport_udp))
+      if (su_casematch(transport, sip_transport_udp))
 	transport = sip_transport_udp;
-      else if (!strcasecmp(transport, sip_transport_tcp))
+      else if (su_casematch(transport, sip_transport_tcp))
 	transport = sip_transport_tcp;
-      else if (!strcasecmp(transport, sip_transport_sctp))
+      else if (su_casematch(transport, sip_transport_sctp))
 	transport = sip_transport_sctp;
-      else if (!strcasecmp(transport, sip_transport_tls))
+      else if (su_casematch(transport, sip_transport_tls))
 	transport = sip_transport_tls;
     }
   }
@@ -526,10 +527,10 @@
       transport == sip_transport_tcp ||
       transport == sip_transport_sctp ||
       transport == sip_transport_tls ||
-      strcasecmp(transport, sip_transport_udp) == 0 ||
-      strcasecmp(transport, sip_transport_tcp) == 0 ||
-      strcasecmp(transport, sip_transport_sctp) == 0 ||
-      strcasecmp(transport, sip_transport_tls) == 0)
+      su_casematch(transport, sip_transport_udp) ||
+      su_casematch(transport, sip_transport_tcp) ||
+      su_casematch(transport, sip_transport_sctp) ||
+      su_casematch(transport, sip_transport_tls))
     return 0;
 
   return MSG_STRING_SIZE(transport);
@@ -546,13 +547,13 @@
     *dd = s;
   else if (s == sip_transport_tls)
     *dd = s;
-  else if (strcasecmp(s, sip_transport_udp) == 0)
+  else if (su_casematch(s, sip_transport_udp))
     *dd = sip_transport_udp;
-  else if (strcasecmp(s, sip_transport_tcp) == 0)
+  else if (su_casematch(s, sip_transport_tcp))
     *dd = sip_transport_tcp;
-  else if (strcasecmp(s, sip_transport_sctp) == 0)
+  else if (su_casematch(s, sip_transport_sctp))
     *dd = sip_transport_sctp;
-  else if (strcasecmp(s, sip_transport_tls) == 0)
+  else if (su_casematch(s, sip_transport_tls))
     *dd = sip_transport_tls;
   else
     MSG_STRING_DUP(*pp, *dd, s);

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_pref_util.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_pref_util.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_pref_util.c	Wed Feb 11 10:52:15 2009
@@ -67,8 +67,8 @@
 
   if (old_type == sp_init) {
     if (s[0] == '\0' ||
-	strcasecmp(s, "TRUE") == 0 ||
-	strcasecmp(s, "\"TRUE\"") == 0) {
+	su_casematch(s, "TRUE") ||
+	su_casematch(s, "\"TRUE\"")) {
       /* Boolean */
       sp->sp_type = sp_literal;
       sp->sp_literal.spl_value = "TRUE";
@@ -76,8 +76,8 @@
       *return_negation = 0;
       *in_out_s = s + strlen(s);
       return 1;
-    } else if (strcasecmp(s, "FALSE") == 0 ||
-	       strcasecmp(s, "\"FALSE\"") == 0) {
+    } else if (su_casematch(s, "FALSE") ||
+	       su_casematch(s, "\"FALSE\"")) {
       /* Boolean */
       sp->sp_type = sp_literal;
       sp->sp_literal.spl_value = "FALSE";
@@ -213,8 +213,8 @@
   case sp_literal:
     return
       a->sp_literal.spl_length == b->sp_literal.spl_length &&
-      strncasecmp(a->sp_literal.spl_value, b->sp_literal.spl_value,
-		  a->sp_literal.spl_length) == 0;
+      su_casenmatch(a->sp_literal.spl_value, b->sp_literal.spl_value,
+		  a->sp_literal.spl_length);
   case sp_string:
     return
       a->sp_string.sps_length == b->sp_string.sps_length &&
@@ -307,7 +307,7 @@
 int sip_is_callerpref(char const *param)
 {
 #define MATCH(s) \
-  (strncasecmp(param + 1, s + 1, strlen(s) - 1) == 0 && \
+  (su_casenmatch(param + 1, s + 1, strlen(s) - 1) && \
    (param[strlen(s)] == '=' || param[strlen(s)] == '\0'))
 
   int xor = 0, base = 0;

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_reason.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_reason.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_reason.c	Wed Feb 11 10:52:15 2009
@@ -160,7 +160,7 @@
     re->re_cause = NULL;
     re->re_text = NULL;
   }
-#define MATCH(s) (namelen == strlen(#s) && !strncasecmp(name, #s, strlen(#s)))
+#define MATCH(s) (namelen == strlen(#s) && su_casenmatch(name, #s, strlen(#s)))
 
   else if (MATCH(cause)) {
     re->re_cause = value;

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_refer.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_refer.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_refer.c	Wed Feb 11 10:52:15 2009
@@ -289,7 +289,7 @@
   if (name == NULL) {
     b->b_cid = NULL;
   }
-  else if (namelen == strlen("cid") && !strncasecmp(name, "cid", namelen)) {
+  else if (namelen == strlen("cid") && su_casenmatch(name, "cid", namelen)) {
     b->b_cid = value;
   }
 
@@ -425,7 +425,7 @@
     rp->rp_from_tag = NULL;
     rp->rp_early_only = 0;
   }
-#define MATCH(s) (namelen == strlen(#s) && !strncasecmp(name, #s, strlen(#s)))
+#define MATCH(s) (namelen == strlen(#s) && su_casenmatch(name, #s, strlen(#s)))
 
   else if (MATCH(to-tag)) {
     rp->rp_to_tag = value;
@@ -502,8 +502,8 @@
   if (msg_token_d(&s, &rs->rs_value) < 0)
     return -1;
 
-  if (strcasecmp(rs->rs_value, "false") &&
-      strcasecmp(rs->rs_value, "true"))
+  if (!su_casematch(rs->rs_value, "false") &&
+      !su_casematch(rs->rs_value, "true"))
     return -1;
 
   if (*s)

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_security.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_security.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_security.c	Wed Feb 11 10:52:15 2009
@@ -525,7 +525,7 @@
     sa->sa_d_qop = NULL;
     sa->sa_d_ver = NULL;
   }
-#define MATCH(s) (namelen == strlen(#s) && !strncasecmp(name, #s, strlen(#s)))
+#define MATCH(s) (namelen == strlen(#s) && su_casenmatch(name, #s, strlen(#s)))
 
   else if (MATCH(q)) {
     sa->sa_q = value;

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_session.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_session.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_session.c	Wed Feb 11 10:52:15 2009
@@ -154,7 +154,7 @@
     x->x_refresher = NULL;
   }
   else if (namelen == strlen("refresher") &&
-	   !strncasecmp(name, "refresher", namelen)) {
+	   su_casenmatch(name, "refresher", namelen)) {
     x->x_refresher = value;
   }
 

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_tag_class.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_tag_class.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_tag_class.c	Wed Feb 11 10:52:15 2009
@@ -450,15 +450,15 @@
     if (n == 0)
       break;
 
-    if (n == 4 && strncasecmp(hnv, "body", 4) == 0)
+    if (n == 4 && su_casenmatch(hnv, "body", 4))
       t = siptag_payload, hc = sip_payload_class;
     else {
       for (j = 0; (t = sip_tag_list[j]); j++) {
 	hc = (msg_hclass_t *)sip_tag_list[j]->tt_magic;
-	if (n == 1 && strncasecmp(hnv, hc->hc_short, 1) == 0)
+	if (n == 1 && su_casenmatch(hnv, hc->hc_short, 1))
 	  break;
 	else if (n == (size_t)hc->hc_len &&
-		 strncasecmp(hnv, hc->hc_name, n) == 0)
+		 su_casenmatch(hnv, hc->hc_name, n))
 	  break;
       }
     }

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c	Wed Feb 11 10:52:15 2009
@@ -39,7 +39,7 @@
 
 #include <sofia-sip/su_alloc.h>
 #include <sofia-sip/su_strlst.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 
 #include "sofia-sip/sip_parser.h"
 #include <sofia-sip/sip_header.h>
@@ -59,8 +59,7 @@
 #include <limits.h>
 #include <ctype.h>
 
-/**
- * Compare two SIP addresses ( @From or @To headers).
+/**Compare two SIP addresses ( @From or @To headers).
  *
  * @retval nonzero if matching.
  * @retval zero if not matching.
@@ -69,13 +68,13 @@
 {
   return
     (a->a_tag == NULL || b->a_tag == NULL ||
-     strcmp(a->a_tag, b->a_tag) == 0)
+     su_casematch(a->a_tag, b->a_tag))
     &&
-    str0casecmp(a->a_host, b->a_host) == 0
+    su_casematch(a->a_host, b->a_host)
     &&
-    str0cmp(a->a_user, b->a_user) == 0
+    su_strmatch(a->a_user, b->a_user)
     &&
-    str0cmp(a->a_url->url_scheme, b->a_url->url_scheme);
+    su_strmatch(a->a_url->url_scheme, b->a_url->url_scheme);
 }
 
 
@@ -164,7 +163,7 @@
   tp = v->v_protocol;
 
   if (tp == sip_transport_udp ||
-      strcasecmp(tp, sip_transport_udp) == 0)  /* Default is UDP */
+      su_casematch(tp, sip_transport_udp))  /* Default is UDP */
     tp = NULL;
 
   return sip_contact_create_from_via_with_transport(home, v, user, tp);
@@ -253,7 +252,7 @@
     port = NULL;
   }
 
-  if (transport && strncasecmp(transport, "SIP/2.0/", 8) == 0)
+  if (su_casenmatch(transport, "SIP/2.0/", 8))
     transport += 8;
 
   /* Make transport parameter lowercase */
@@ -292,8 +291,8 @@
 
   /* transport name starts with TLS or SIP/2.0/TLS */
   return
-    strncasecmp(transport_name, "TLS", 3) == 0 ||
-    strncasecmp(transport_name, sip_transport_tls, 11) == 0;
+    su_casenmatch(transport_name, "TLS", 3) ||
+    su_casenmatch(transport_name, sip_transport_tls, 11);
 }
 
 /**Perform sanity check on a SIP message
@@ -339,9 +338,10 @@
 
     if (sip->sip_request->rq_method != sip->sip_cseq->cs_method)
       return -1;
+
     if (sip->sip_request->rq_method == sip_method_unknown &&
-	str0casecmp(sip->sip_request->rq_method_name,
-		    sip->sip_cseq->cs_method_name))
+	!su_strmatch(sip->sip_request->rq_method_name,
+		     sip->sip_cseq->cs_method_name))
       return -1;
   }
 
@@ -810,10 +810,10 @@
     if (s == NULL || v == NULL)
       return (s == NULL) - (v == NULL);
 
-    if ((retval = str0cmp(s->sa_mec, v->sa_mec)))
+    if ((retval = su_strcmp(s->sa_mec, v->sa_mec)))
       return retval;
 
-    digest = strcasecmp(s->sa_mec, "Digest") == 0;
+    digest = su_casematch(s->sa_mec, "Digest");
 
     s_params = s->sa_params, v_params = v->sa_params;
 
@@ -828,13 +828,13 @@
 
     for (i = 0, j = 0;; i++, j++) {
       if (digest && v_params[j] &&
-	  strncasecmp(v_params[j], "d-ver=", 6) == 0) {
+	  su_casenmatch(v_params[j], "d-ver=", 6)) {
 	if (return_d_ver)
 	  *return_d_ver = v_params[j] + strlen("d-ver=");
 	j++;
       }
 
-      retval = str0cmp(s_params[i], v_params[j]);
+      retval = su_strcmp(s_params[i], v_params[j]);
 
       if (retval || s_params[i] == NULL || v_params[j] == NULL)
 	break;
@@ -861,7 +861,7 @@
 
   for (s = server; s; s = s->sa_next) {
     for (c = client; c; c = c->sa_next) {
-      if (str0cmp(s->sa_mec, c->sa_mec) == 0)
+      if (su_strmatch(s->sa_mec, c->sa_mec))
 	return c;
     }
   }

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_parser.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_parser.h	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_parser.h	Wed Feb 11 10:52:15 2009
@@ -60,6 +60,10 @@
 #include <sofia-sip/sip_header.h>
 #endif
 
+#ifndef SOFIA_SIP_SU_STRING_H
+#include <sofia-sip/su_string.h>
+#endif
+
 SOFIA_BEGIN_DECLS
 
 /* ---------------------------------------------------------------------------

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/test_date.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/test_date.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/test_date.c	Wed Feb 11 10:52:15 2009
@@ -36,7 +36,7 @@
 #include "config.h"
 
 #include <stdio.h>
-#include <sofia-sip/string0.h>
+#include <sofia-sip/su_string.h>
 #include <stddef.h>
 #include <stdlib.h>
 
@@ -62,7 +62,7 @@
   t = ((31 + 27) * 24) * 60 * 60;
   delta = (365 * 24 + 6) * 60 * 60;
 
-  if (str0cmp(av[1], "-v") == 0)
+  if (su_strmatch(av[1], "-v"))
     verbatim = 1, av++;
 
   if ((s = av[1])) {



More information about the Freeswitch-svn mailing list