tree-wide: rename unref_and_replace_full to unref_and_replace_new_ref
We have a number of *_unref_and_replace macros. One could think that they are like the various free_and_replace variants, but they actually create a new ref to the passed object. The free_and_replace variants take ownership of the argument. This inconsistency is surprising. Rename all those functions to have "_new_ref" at the end to make the difference clear.
This commit is contained in:
@@ -364,7 +364,7 @@ static int dhcp6_lease_information_acquired(sd_dhcp6_client *client, Link *link)
|
||||
if (r < 0)
|
||||
return log_link_error_errno(link, r, "Failed to get DHCPv6 lease: %m");
|
||||
|
||||
unref_and_replace_full(link->dhcp6_lease, lease, sd_dhcp6_lease_ref, sd_dhcp6_lease_unref);
|
||||
unref_and_replace_new_ref(link->dhcp6_lease, lease, sd_dhcp6_lease_ref, sd_dhcp6_lease_unref);
|
||||
|
||||
link_dirty(link);
|
||||
return 0;
|
||||
|
||||
@@ -1678,7 +1678,7 @@ static int link_initialized(Link *link, sd_device *device) {
|
||||
|
||||
/* Always replace with the new sd_device object. As the sysname (and possibly other properties
|
||||
* or sysattrs) may be outdated. */
|
||||
device_unref_and_replace(link->dev, device);
|
||||
device_unref_and_replace_new_ref(link->dev, device);
|
||||
|
||||
r = link_managed_by_us(link);
|
||||
if (r <= 0)
|
||||
|
||||
@@ -469,7 +469,7 @@ int manager_udev_process_wiphy(Manager *m, sd_device *device, sd_device_action_t
|
||||
return 0;
|
||||
}
|
||||
|
||||
return device_unref_and_replace(w->dev, action == SD_DEVICE_REMOVE ? NULL : device);
|
||||
return device_unref_and_replace_new_ref(w->dev, action == SD_DEVICE_REMOVE ? NULL : device);
|
||||
}
|
||||
|
||||
int manager_udev_process_rfkill(Manager *m, sd_device *device, sd_device_action_t action) {
|
||||
@@ -501,5 +501,5 @@ int manager_udev_process_rfkill(Manager *m, sd_device *device, sd_device_action_
|
||||
return 0;
|
||||
}
|
||||
|
||||
return device_unref_and_replace(w->rfkill, action == SD_DEVICE_REMOVE ? NULL : device);
|
||||
return device_unref_and_replace_new_ref(w->rfkill, action == SD_DEVICE_REMOVE ? NULL : device);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user