Browse Source

ipv4 and ipv6 hashing functions

personal/stbuehler/wip
Thomas Porzelt 14 years ago
parent
commit
21c391da66
  1. 2
      src/plugin.c
  2. 10
      src/utils.c
  3. 3
      src/utils.h

2
src/plugin.c

@ -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;

10
src/utils.c

@ -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];
}

3
src/utils.h

@ -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

Loading…
Cancel
Save