2
0
Fork 0

ipv4 and ipv6 hashing functions

This commit is contained in:
Thomas Porzelt 2008-10-02 02:33:51 +02:00
parent f23b051c30
commit 21c391da66
3 changed files with 14 additions and 1 deletions

View File

@ -224,7 +224,7 @@ gboolean parse_option(server *srv, const char *name, value *val, option_set *mar
void release_option(server *srv, option_set *mark) { /** Does not free the option_set memory */
server_option *sopt;
if (!srv || !mark || !sopt) return;
if (!srv || !mark || !mark->sopt) return;
sopt = mark->sopt;
mark->sopt = NULL;

View File

@ -274,3 +274,13 @@ gchar *ev_backend_string(guint backend) {
void string_destroy_notify(gpointer str) {
g_string_free((GString*)str, TRUE);
}
guint hash_ipv4(gconstpointer key) {
return GPOINTER_TO_UINT(key);
}
guint hash_ipv6(gconstpointer key) {
guint *i = ((guint*)key);
return i[0] ^ i[1] ^ i[2] ^ i[3];
}

View File

@ -26,4 +26,7 @@ LI_API gchar *ev_backend_string(guint backend);
LI_API void string_destroy_notify(gpointer str);
LI_API guint hash_ipv4(gconstpointer key);
LI_API guint hash_ipv6(gconstpointer key);
#endif