summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Saavedra <csaavedra@igalia.com>2018-08-08 13:53:58 +0300
committerClaudio Saavedra <csaavedra@igalia.com>2018-08-10 07:22:11 +0000
commit5e50df9fe36c262b0f0741dfc679b9336582893a (patch)
tree75b72caf74fc30bcff2178b822de418dd76712b1
parentdfc4a9ee505ce63c00b40c8a00a3c2d250af1025 (diff)
downloadlibsoup-5e50df9fe36c262b0f0741dfc679b9336582893a.tar.gz
Simplify soup_host_matches_host()
There is no need for a hand-written iteration finding a suffix. Use g_str_has_suffix() instead which is cleaner.
-rw-r--r--libsoup/soup-misc.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/libsoup/soup-misc.c b/libsoup/soup-misc.c
index c583d901..2cf6b0f6 100644
--- a/libsoup/soup-misc.c
+++ b/libsoup/soup-misc.c
@@ -257,9 +257,6 @@ const char soup_char_attributes[] = {
gboolean
soup_host_matches_host (const gchar *host, const gchar *compare_with)
{
- char *match;
- int dlen;
-
g_return_val_if_fail (host != NULL, FALSE);
g_return_val_if_fail (compare_with != NULL, FALSE);
@@ -269,11 +266,5 @@ soup_host_matches_host (const gchar *host, const gchar *compare_with)
return FALSE;
if (!g_ascii_strcasecmp (host + 1, compare_with))
return TRUE;
- dlen = strlen (host);
- while ((match = strstr (compare_with, host))) {
- if (!match[dlen])
- return TRUE;
- compare_with = match + 1;
- }
- return FALSE;
+ return g_str_has_suffix (compare_with, host);
}