summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/util.c b/util.c
index 2cd0a87..20dd684 100644
--- a/util.c
+++ b/util.c
@@ -133,7 +133,7 @@ gint flx_age(const GTimeVal *a) {
return flx_timeval_diff(&now, a);
}
-gboolean flx_domain_equal(const gchar *a, const gchar *b) {
+gboolean flx_domain_cmp(const gchar *a, const gchar *b) {
int escaped_a = 0, escaped_b = 0;
g_assert(a);
g_assert(b);
@@ -148,18 +148,17 @@ gboolean flx_domain_equal(const gchar *a, const gchar *b) {
/* Check for string end */
if (*a == 0 && *b == 0)
- return TRUE;
+ return 0;
if (*a == 0 && !escaped_b && *b == '.' && *(b+1) == 0)
- return TRUE;
+ return 0;
if (!escaped_a && *a == '.' && *(a+1) == 0 && *b == 0)
- return TRUE;
+ return 0;
/* Compare characters */
if (escaped_a == escaped_b && *a != *b)
- return FALSE;
-
+ return *a < *b ? -1 : 1;
/* Next characters */
a++;
@@ -168,6 +167,10 @@ gboolean flx_domain_equal(const gchar *a, const gchar *b) {
}
}
+gboolean flx_domain_equal(const gchar *a, const gchar *b) {
+ return flx_domain_cmp(a, b) == 0;
+}
+
guint flx_domain_hash(const gchar *p) {
char t[256];
strncpy(t, p, sizeof(t)-1);