summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-05-03 15:29:10 +0000
committerLennart Poettering <lennart@poettering.net>2005-05-03 15:29:10 +0000
commitbf2db17686a0e29b4e855cadbbaa5e5e4ed2def8 (patch)
tree5ed3e689a33892a3e944c3f87e38d638aeb462cd /util.c
parent4128ce517280dde1e09d0d86b570f5a413812494 (diff)
* Complete conflict detection stuff (including probing et al)
* Introduce flxEntryGroups (replacing IDs) * priorize main loop sources git-svn-id: file:///home/lennart/svn/public/avahi/trunk@33 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
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);