Commit 9306d157 authored by Pekka Pessi's avatar Pekka Pessi

nta, nth, url: use host_cmp() where appropriate

darcs-hash:20061122181607-65a35-f054dfc87ff904fc16ddd8e826b02b3c1acd039c.gz
parent 38f2412e
...@@ -66,6 +66,8 @@ ...@@ -66,6 +66,8 @@
#include <sofia-sip/sip_util.h> #include <sofia-sip/sip_util.h>
#include <sofia-sip/sip_status.h> #include <sofia-sip/sip_status.h>
#include <sofia-sip/hostdomain.h>
#include <sofia-sip/msg_addr.h> #include <sofia-sip/msg_addr.h>
#include <sofia-sip/msg_parser.h> #include <sofia-sip/msg_parser.h>
...@@ -2327,7 +2329,7 @@ int agent_aliases(nta_agent_t const *agent, url_t url[], tport_t *tport) ...@@ -2327,7 +2329,7 @@ int agent_aliases(nta_agent_t const *agent, url_t url[], tport_t *tport)
if (url->url_type != m->m_url->url_type) if (url->url_type != m->m_url->url_type)
continue; continue;
if (strcasecmp(url->url_host, m->m_url->url_host)) if (host_cmp(url->url_host, m->m_url->url_host))
continue; continue;
if (url->url_port == NULL) if (url->url_port == NULL)
...@@ -3800,7 +3802,7 @@ int addr_cmp(url_t const *a, url_t const *b) ...@@ -3800,7 +3802,7 @@ int addr_cmp(url_t const *a, url_t const *b)
return 0; return 0;
else else
return return
str0casecmp(a->url_host, b->url_host) host_cmp(a->url_host, b->url_host)
|| str0cmp(a->url_port, b->url_port) || str0cmp(a->url_port, b->url_port)
|| str0cmp(a->url_user, b->url_user); || str0cmp(a->url_user, b->url_user);
} }
......
...@@ -61,6 +61,8 @@ ...@@ -61,6 +61,8 @@
#include <sofia-sip/http_tag.h> #include <sofia-sip/http_tag.h>
#include <sofia-sip/http_status.h> #include <sofia-sip/http_status.h>
#include <sofia-sip/hostdomain.h>
#include <sofia-sip/msg_addr.h> #include <sofia-sip/msg_addr.h>
#include <sofia-sip/su_tagarg.h> #include <sofia-sip/su_tagarg.h>
...@@ -744,7 +746,7 @@ url_string_t const *hc_request_complete(nth_client_t * hc, ...@@ -744,7 +746,7 @@ url_string_t const *hc_request_complete(nth_client_t * hc,
hc->hc_route_url = (url_string_t *) u; hc->hc_route_url = (url_string_t *) u;
if (host && if (host &&
(str0casecmp(host->h_host, u->url_host) || (host_cmp(host->h_host, u->url_host) ||
str0cmp(host->h_port, u->url_port))) str0cmp(host->h_port, u->url_port)))
host = NULL; host = NULL;
......
...@@ -61,6 +61,8 @@ typedef struct server_s server_t; ...@@ -61,6 +61,8 @@ typedef struct server_s server_t;
#include <sofia-sip/msg_addr.h> #include <sofia-sip/msg_addr.h>
#include <sofia-sip/su_tagarg.h> #include <sofia-sip/su_tagarg.h>
#include <sofia-sip/hostdomain.h>
/* We are customer of tport_t */ /* We are customer of tport_t */
#define TP_STACK_T server_t #define TP_STACK_T server_t
#define TP_MAGIC_T void #define TP_MAGIC_T void
...@@ -569,7 +571,7 @@ nth_site_t **site_get_host(nth_site_t **list, char const *host, char const *port ...@@ -569,7 +571,7 @@ nth_site_t **site_get_host(nth_site_t **list, char const *host, char const *port
assert(host); assert(host);
for (; (site = *list); list = &site->site_next) { for (; (site = *list); list = &site->site_next) {
if (strcasecmp(host, site->site_url->url_host) == 0 && if (host_cmp(host, site->site_url->url_host) == 0 &&
str0cmp(port, site->site_url->url_port) == 0) { str0cmp(port, site->site_url->url_port) == 0) {
break; break;
} }
......
...@@ -1532,9 +1532,7 @@ int url_cmp(url_t const *a, url_t const *b) ...@@ -1532,9 +1532,7 @@ int url_cmp(url_t const *a, url_t const *b)
(rv = strcasecmp(a->url_scheme, b->url_scheme))))) (rv = strcasecmp(a->url_scheme, b->url_scheme)))))
return rv; return rv;
if (a->url_host != b->url_host && if ((rv = host_cmp(a->url_host, b->url_host)))
((rv = !a->url_host - !b->url_host) ||
(rv = strcasecmp(a->url_host, b->url_host))))
return rv; return rv;
if (a->url_port != b->url_port) { if (a->url_port != b->url_port) {
...@@ -1645,9 +1643,7 @@ int url_cmp_all(url_t const *a, url_t const *b) ...@@ -1645,9 +1643,7 @@ int url_cmp_all(url_t const *a, url_t const *b)
if ((rv = a->url_root - b->url_root)) if ((rv = a->url_root - b->url_root))
return rv; return rv;
if (a->url_host != b->url_host && if ((rv = host_cmp(a->url_host, b->url_host)))
((rv = !a->url_host - !b->url_host) ||
(rv = strcasecmp(a->url_host, b->url_host))))
return rv; return rv;
if (a->url_port != b->url_port) { if (a->url_port != b->url_port) {
......
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