Thu Jan 8 14:55:01 CST 2009 Pekka Pessi <first.last@nokia.com>

* bnf: using <sofia-sip/su_string.h>



git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11801 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2009-02-11 16:49:51 +00:00
parent 31367efd3b
commit 070546335d
3 changed files with 8 additions and 7 deletions

View File

@ -1 +1 @@
Wed Feb 11 10:49:17 CST 2009 Wed Feb 11 10:49:44 CST 2009

View File

@ -26,7 +26,7 @@ libbnf_la_SOURCES = bnf.c
COVERAGE_INPUT = $(libbnf_la_SOURCES) $(include_sofia_HEADERS) COVERAGE_INPUT = $(libbnf_la_SOURCES) $(include_sofia_HEADERS)
LDADD = libbnf.la LDADD = libbnf.la ../su/libsu.la
torture_bnf_LDFLAGS = -static torture_bnf_LDFLAGS = -static

View File

@ -34,6 +34,7 @@
#include "config.h" #include "config.h"
#include "sofia-sip/bnf.h" #include "sofia-sip/bnf.h"
#include "sofia-sip/su_string.h"
#include <stdio.h> #include <stdio.h>
#include <assert.h> #include <assert.h>
@ -795,12 +796,12 @@ int host_is_local(char const *host)
return return
n >= 9 /* strlen("localhost") */ && n >= 9 /* strlen("localhost") */ &&
strncasecmp(host, "localhost", 9) == 0 && su_casenmatch(host, "localhost", 9) &&
(n == 9 || (n == 9 ||
((n == 10 || /* localhost. */ ((n == 10 || /* localhost. */
n == 21 || /* strlen("localhost.localdomain") */ n == 21 || /* strlen("localhost.localdomain") */
n == 22) && /* strlen("localhost.localdomain.") */ n == 22) && /* strlen("localhost.localdomain.") */
strncasecmp(host + 9, ".localdomain.", n - 9) == 0)); su_casenmatch(host + 9, ".localdomain.", n - 9)));
} }
/** Return true if @a string has domain name in "invalid." domain. /** Return true if @a string has domain name in "invalid." domain.
@ -815,9 +816,9 @@ int host_has_domain_invalid(char const *string)
if (string[n - 1] == '.') /* .invalid. perhaps? */ if (string[n - 1] == '.') /* .invalid. perhaps? */
n--; n--;
if (n == 7 /* strlen("invalid") */) if (n == 7 /* strlen("invalid") */)
return strncasecmp(string, invalid + 1, 7) == 0; return su_casenmatch(string, invalid + 1, 7);
else else
return strncasecmp(string + n - 8, invalid, 8) == 0; return su_casenmatch(string + n - 8, invalid, 8);
} }
return 0; return 0;
@ -913,7 +914,7 @@ int host_cmp(char const *a, char const *b)
retval = memcmp(a6, b6, asize); retval = memcmp(a6, b6, asize);
} }
else { else {
retval = strcasecmp(a, b); retval = su_strcasecmp(a, b);
} }
} }