X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-common%2Fdomain.c;h=3703a0426f49352ab3e594beb2bc88d543876b0b;hb=4f0a5e7572a4257894b4bfede42c26d65152609e;hp=5a51a39ae58cd4f40e7eb24d393caca68b92fc26;hpb=d6d7d3769441b73ffb5b7af34fef823b41e66312;p=catta diff --git a/avahi-common/domain.c b/avahi-common/domain.c index 5a51a39..3703a04 100644 --- a/avahi-common/domain.c +++ b/avahi-common/domain.c @@ -320,3 +320,20 @@ int avahi_is_valid_host_name(const char *t) { return 1; } + +unsigned avahi_domain_hash(const char *s) { + unsigned hash = 0; + + for (;;) { + char c[65], *p; + + if (!avahi_unescape_label(&s, c, sizeof(c))) + return hash; + + if (!c[0]) + continue; + + for (p = c; *p; p++) + hash = 31 * hash + tolower(*p); + } +}