ether-addr-util: introduce {hw,ether}_addr_hash_ops_free

This commit is contained in:
Yu Watanabe
2021-11-09 21:39:09 +09:00
parent aa4f765326
commit c6df73ca72
5 changed files with 10 additions and 8 deletions
+2 -4
View File
@@ -1384,7 +1384,7 @@ int config_parse_ether_addrs(
if (isempty(rvalue)) {
/* Empty assignment resets the list */
*hwaddrs = set_free_free(*hwaddrs);
*hwaddrs = set_free(*hwaddrs);
return 0;
}
@@ -1414,11 +1414,9 @@ int config_parse_ether_addrs(
continue;
}
r = set_ensure_put(hwaddrs, &ether_addr_hash_ops, n);
r = set_ensure_consume(hwaddrs, &ether_addr_hash_ops_free, TAKE_PTR(n));
if (r < 0)
return log_oom();
if (r > 0)
TAKE_PTR(n); /* avoid cleanup */
}
}
+3 -3
View File
@@ -17,8 +17,8 @@ void net_match_clear(NetMatch *match) {
if (!match)
return;
match->mac = set_free_free(match->mac);
match->permanent_mac = set_free_free(match->permanent_mac);
match->mac = set_free(match->mac);
match->permanent_mac = set_free(match->permanent_mac);
match->path = strv_free(match->path);
match->driver = strv_free(match->driver);
match->iftype = strv_free(match->iftype);
@@ -26,7 +26,7 @@ void net_match_clear(NetMatch *match) {
match->property = strv_free(match->property);
match->wlan_iftype = strv_free(match->wlan_iftype);
match->ssid = strv_free(match->ssid);
match->bssid = set_free_free(match->bssid);
match->bssid = set_free(match->bssid);
}
bool net_match_is_empty(const NetMatch *match) {