diff options
author | Lennart Poettering <lennart@poettering.net> | 2005-08-13 21:25:09 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2005-08-13 21:25:09 +0000 |
commit | 4f0a5e7572a4257894b4bfede42c26d65152609e (patch) | |
tree | 21e3d5ee20716739590e5931859a4c2052161395 /avahi-common/domain.c | |
parent | d6d7d3769441b73ffb5b7af34fef823b41e66312 (diff) |
* strip glib from avahi-core
* implement glib memory allocator
* add new documentation file MALLOC
* initialize pseudo-RNG from /dev/urandom in avahi-daemon
* remove some gcc 4.0 warnings
* beef up watch system with real timeouts
* move GCC __attribute__ macros into its own header avahi-common/gccmacro.h
* make use of GCC's sentinel attribute where it make sense
* add malloc() implementations that abort on OOM and enable them by default
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@308 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-common/domain.c')
-rw-r--r-- | avahi-common/domain.c | 17 |
1 files changed, 17 insertions, 0 deletions
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); + } +} |