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

FreeSWITCH SVN mikej at freeswitch.org
Wed Feb 11 08:51:45 PST 2009


Author: mikej
Date: Wed Feb 11 10:51:44 2009
New Revision: 11805

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



Modified:
   freeswitch/trunk/libs/sofia-sip/.update
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/resolve_sip.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_cache.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:51:44 2009
@@ -1 +1 @@
-Wed Feb 11 10:51:07 CST 2009
+Wed Feb 11 10:51:28 CST 2009

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/resolve_sip.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/resolve_sip.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/resolve_sip.c	Wed Feb 11 10:51:44 2009
@@ -41,6 +41,7 @@
 #define SRES_CONTEXT_T struct context
 
 #include "sofia-sip/sresolv.h"
+#include "sofia-sip/su_string.h"
 
 char const name[] = "sip_resolve";
 
@@ -121,7 +122,7 @@
 
     switch (na->na_flags[0]) {
     case 's': /* srv */
-      if (strncasecmp("SIP+", na->na_services, 4))
+      if (!su_casenmatch("SIP+", na->na_services, 4))
 	/* Something else but SIP */
 	break;
       query_srv(sr, na->na_replace);
@@ -129,7 +130,7 @@
       return;
 
     case 'a':
-      if (strncasecmp("SIP+", na->na_services, 4))
+      if (!su_casenmatch("SIP+", na->na_services, 4))
 	/* Something else but SIP */
 	break;
       query_a(sr, na->na_replace);

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c	Wed Feb 11 10:51:44 2009
@@ -83,6 +83,7 @@
 
 #include <sofia-sip/su_alloc.h>
 #include <sofia-sip/su_strlst.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/su_errno.h>
 
 #include "sofia-sip/htable.h"
@@ -1572,8 +1573,8 @@
     {
       sres_soa_record_t const *A = aa->sr_soa, *B = bb->sr_soa;
       D = A->soa_serial - B->soa_serial; if (D) return D;
-      D = strcasecmp(A->soa_mname, B->soa_mname); if (D) return D;
-      D = strcasecmp(A->soa_rname, B->soa_rname); if (D) return D;
+      D = su_strcasecmp(A->soa_mname, B->soa_mname); if (D) return D;
+      D = su_strcasecmp(A->soa_rname, B->soa_rname); if (D) return D;
       D = A->soa_refresh - B->soa_refresh; if (D) return D;
       D = A->soa_retry - B->soa_retry; if (D) return D;
       D = A->soa_expire - B->soa_expire; if (D) return D;
@@ -1591,7 +1592,7 @@
       D = A->a6_prelen - B->a6_prelen; if (D) return D;
       D = !A->a6_prename - !B->a6_prename;
       if (D == 0 && A->a6_prename && B->a6_prename)
-	D = strcasecmp(A->a6_prename, B->a6_prename); if (D) return D;
+	D = su_strcasecmp(A->a6_prename, B->a6_prename); if (D) return D;
       return memcmp(&A->a6_suffix, &B->a6_suffix, sizeof A->a6_suffix);
     }
   case sres_type_aaaa:
@@ -2251,7 +2252,7 @@
       len = strcspn(b, " \t");
       value = b + len; value += strspn(value, " \t");
 
-#define MATCH(token) (len == strlen(token) && strncasecmp(token, b, len) == 0)
+#define MATCH(token) (len == strlen(token) && su_casenmatch(token, b, len))
 
       if (MATCH("nameserver")) {
 	if (sres_parse_nameserver(c, value) < 0)

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_cache.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_cache.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_cache.c	Wed Feb 11 10:51:44 2009
@@ -64,6 +64,7 @@
 
 #include <sofia-sip/su_alloc.h>
 #include <sofia-sip/su_strlst.h>
+#include <sofia-sip/su_string.h>
 #include <sofia-sip/htable.h>
 #include <sofia-sip/heap.h>
 
@@ -209,7 +210,7 @@
 	now <= (*rr_iter)->rr_expires &&
         (type == sres_qtype_any || rr->sr_type == type) &&
         rr->sr_name != NULL &&
-        strcasecmp(rr->sr_name, domain) == 0)
+        su_casematch(rr->sr_name, domain))
       rr_count++;
   }
 
@@ -236,7 +237,7 @@
 	now <= (*rr_iter)->rr_expires &&
         (type == sres_qtype_any || rr->sr_type == type) &&
         rr->sr_name != NULL &&
-        strcasecmp(rr->sr_name, domain) == 0) {
+        su_casematch(rr->sr_name, domain)) {
       SU_DEBUG_9(("rr found in cache: %s %02d\n",
 		  rr->sr_name, rr->sr_type));
 
@@ -335,7 +336,7 @@
     if (!!or->sr_name != !!rr->sr_name)
       continue;
     if (or->sr_name != rr->sr_name &&
-	strcasecmp(or->sr_name, rr->sr_name) != 0)
+	!su_casematch(or->sr_name, rr->sr_name))
       continue;
     if (rr->sr_type != sres_type_soa /* There can be only one */
 	&& sres_record_compare(or, rr))
@@ -526,13 +527,13 @@
 
     if (rr && rr->sr_name &&
 	sres_type_srv == rr->sr_type &&
-	strcasecmp(rr->sr_name, domain) == 0) {
+	su_casematch(rr->sr_name, domain)) {
 
       (*iter)->rr_expires = expires;
 
       if ((port == 0 || rr->sr_srv->srv_port == port) &&
 	  rr->sr_srv->srv_target &&
-	  strcasecmp(rr->sr_srv->srv_target, target) == 0) {
+	  su_casematch(rr->sr_srv->srv_target, target)) {
 	/* record found --> change priority of server */
 	rr->sr_srv->srv_priority = priority;
 	ret++;



More information about the Freeswitch-svn mailing list