1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00

network: address_equal() is not used anymore, hence move it to test-network.c

This commit is contained in:
Yu Watanabe 2021-09-08 11:32:40 +09:00
parent 3b6a3bdebf
commit b87e96e2f2
3 changed files with 10 additions and 11 deletions

View File

@ -316,16 +316,6 @@ int address_compare_func(const Address *a1, const Address *a2) {
DEFINE_HASH_OPS_WITH_KEY_DESTRUCTOR(address_hash_ops, Address, address_hash_func, address_compare_func, address_free); DEFINE_HASH_OPS_WITH_KEY_DESTRUCTOR(address_hash_ops, Address, address_hash_func, address_compare_func, address_free);
bool address_equal(const Address *a1, const Address *a2) {
if (a1 == a2)
return true;
if (!a1 || !a2)
return false;
return address_compare_func(a1, a2) == 0;
}
int address_dup(const Address *src, Address **ret) { int address_dup(const Address *src, Address **ret) {
_cleanup_(address_freep) Address *dest = NULL; _cleanup_(address_freep) Address *dest = NULL;
int r; int r;

View File

@ -63,7 +63,6 @@ Address* address_free(Address *address);
int address_get(Link *link, const Address *in, Address **ret); int address_get(Link *link, const Address *in, Address **ret);
int address_configure_handler_internal(sd_netlink *rtnl, sd_netlink_message *m, Link *link, const char *error_msg); int address_configure_handler_internal(sd_netlink *rtnl, sd_netlink_message *m, Link *link, const char *error_msg);
int address_remove(Address *address); int address_remove(Address *address);
bool address_equal(const Address *a1, const Address *a2);
int address_dup(const Address *src, Address **ret); int address_dup(const Address *src, Address **ret);
bool address_is_ready(const Address *a); bool address_is_ready(const Address *a);
void address_set_broadcast(Address *a); void address_set_broadcast(Address *a);

View File

@ -170,6 +170,16 @@ static int test_load_config(Manager *manager) {
return 0; return 0;
} }
static bool address_equal(const Address *a1, const Address *a2) {
if (a1 == a2)
return true;
if (!a1 || !a2)
return false;
return address_compare_func(a1, a2) == 0;
}
static void test_address_equality(void) { static void test_address_equality(void) {
_cleanup_(address_freep) Address *a1 = NULL, *a2 = NULL; _cleanup_(address_freep) Address *a1 = NULL, *a2 = NULL;