Commit db70ea24 authored by Pekka Pessi's avatar Pekka Pessi

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

darcs-hash:20090108205501-db55f-528c3bc612a874bfaa54b40af73f2750b681f394.gz
parent f23652ed
...@@ -26,7 +26,7 @@ libbnf_la_SOURCES = bnf.c ...@@ -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
......
...@@ -34,6 +34,7 @@ ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment