mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-20 15:10:05 +01:00
glib-aux: add nm_ether_addr_hash() helper
Add a hash generation helper for NMEtherAddr struct. This can be used for HashTables containing pointers to NMEtherAddr structs.
This commit is contained in:
parent
69f3493670
commit
a63eec924c
2 changed files with 13 additions and 0 deletions
|
|
@ -58,6 +58,17 @@ nm_ether_addr_from_string(NMEtherAddr *addr, const char *str)
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guint
|
||||||
|
nm_ether_addr_hash(const NMEtherAddr *a)
|
||||||
|
{
|
||||||
|
NMHashState h;
|
||||||
|
|
||||||
|
nm_hash_init(&h, 1947951703u);
|
||||||
|
nm_hash_update(&h, a, sizeof(NMEtherAddr));
|
||||||
|
|
||||||
|
return nm_hash_complete(&h);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -241,6 +241,8 @@ nm_ether_addr_is_zero(const NMEtherAddr *a)
|
||||||
return nm_memeq(a, &nm_ether_addr_zero, sizeof(NMEtherAddr));
|
return nm_memeq(a, &nm_ether_addr_zero, sizeof(NMEtherAddr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guint nm_ether_addr_hash(const NMEtherAddr *a);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
struct ether_addr;
|
struct ether_addr;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue