Logo Search packages:      
Sourcecode: avahi version File versions  Download package

unsigned avahi_domain_hash ( const char *  name )

Return some kind of hash value for the domain, useful for using domains as hash table keys.

Definition at line 424 of file domain.c.

References AVAHI_LABEL_MAX.

                                          {
    unsigned hash = 0;

    while (*s) {
        char c[AVAHI_LABEL_MAX], *p, *r;

        r = avahi_unescape_label(&s, c, sizeof(c));
        assert(r);

        for (p = c; *p; p++)
            hash = 31 * hash + tolower(*p);
    }

    return hash;
}

Generated by  Doxygen 1.6.0   Back to index