ipv4 and ipv6 hashing functions
This commit is contained in:
parent
f23b051c30
commit
21c391da66
|
@ -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
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];
|
||||
}
|
||||
|
|
|
@ -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…
Reference in New Issue