avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
AvahiHashFunc hash_func;
AvahiEqualFunc equal_func;
AvahiFreeFunc key_free_func, value_free_func;
AvahiHashFunc hash_func;
AvahiEqualFunc equal_func;
AvahiFreeFunc key_free_func, value_free_func;
Entry *entries[HASH_MAP_SIZE];
AVAHI_LLIST_HEAD(Entry, entries_list);
};
Entry *entries[HASH_MAP_SIZE];
AVAHI_LLIST_HEAD(Entry, entries_list);
};
for (e = m->entries[idx]; e; e = e->bucket_next)
if (m->equal_func(key, e->key))
return e;
for (e = m->entries[idx]; e; e = e->bucket_next)
if (m->equal_func(key, e->key))
return e;
AvahiHashmap* avahi_hashmap_new(AvahiHashFunc hash_func, AvahiEqualFunc equal_func, AvahiFreeFunc key_free_func, AvahiFreeFunc value_free_func) {
AvahiHashmap *m;
AvahiHashmap* avahi_hashmap_new(AvahiHashFunc hash_func, AvahiEqualFunc equal_func, AvahiFreeFunc key_free_func, AvahiFreeFunc value_free_func) {
AvahiHashmap *m;
idx = m->hash_func(key) % HASH_MAP_SIZE;
AVAHI_LLIST_PREPEND(Entry, bucket, m->entries[idx], e);
idx = m->hash_func(key) % HASH_MAP_SIZE;
AVAHI_LLIST_PREPEND(Entry, bucket, m->entries[idx], e);
idx = m->hash_func(key) % HASH_MAP_SIZE;
AVAHI_LLIST_PREPEND(Entry, bucket, m->entries[idx], e);
idx = m->hash_func(key) % HASH_MAP_SIZE;
AVAHI_LLIST_PREPEND(Entry, bucket, m->entries[idx], e);
int avahi_string_equal(const void *a, const void *b) {
const char *p = a, *q = b;
int avahi_string_equal(const void *a, const void *b) {
const char *p = a, *q = b;
return strcmp(p, q) == 0;
}
unsigned avahi_int_hash(const void *data) {
const int *i = data;
return strcmp(p, q) == 0;
}
unsigned avahi_int_hash(const void *data) {
const int *i = data;
return (unsigned) *i;
}
int avahi_int_equal(const void *a, const void *b) {
const int *_a = a, *_b = b;
return (unsigned) *i;
}
int avahi_int_equal(const void *a, const void *b) {
const int *_a = a, *_b = b;