1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00

udev-event: rename udev_event_unref() to udev_event_free()

As struct udev_event does not have a reference counter.
This commit is contained in:
Yu Watanabe 2018-10-25 07:04:59 +09:00
parent d737197154
commit c1118ceba4
5 changed files with 11 additions and 11 deletions

View File

@ -52,7 +52,7 @@ static int fake_filesystems(void) {
}
int main(int argc, char *argv[]) {
_cleanup_(udev_event_unrefp) struct udev_event *event = NULL;
_cleanup_(udev_event_freep) struct udev_event *event = NULL;
_cleanup_(udev_device_unrefp) struct udev_device *dev = NULL;
_cleanup_(udev_rules_unrefp) struct udev_rules *rules = NULL;
const char *devpath, *action;

View File

@ -58,11 +58,12 @@ struct udev_event *udev_event_new(struct udev_device *dev) {
return event;
}
void udev_event_unref(struct udev_event *event) {
struct udev_event *udev_event_free(struct udev_event *event) {
void *p;
if (event == NULL)
return;
if (!event)
return NULL;
sd_netlink_unref(event->rtnl);
while ((p = hashmap_steal_first_key(event->run_list)))
free(p);
@ -70,7 +71,8 @@ void udev_event_unref(struct udev_event *event) {
hashmap_free_free_free(event->seclabel_list);
free(event->program_result);
free(event->name);
free(event);
return mfree(event);
}
enum subst_type {

View File

@ -61,7 +61,7 @@ int udev_rules_apply_static_dev_perms(struct udev_rules *rules);
/* udev-event.c */
struct udev_event *udev_event_new(struct udev_device *dev);
void udev_event_unref(struct udev_event *event);
struct udev_event *udev_event_free(struct udev_event *event);
size_t udev_event_apply_format(struct udev_event *event,
const char *src, char *dest, size_t size,
bool replace_whitespace);
@ -79,5 +79,5 @@ void udev_event_execute_rules(struct udev_event *event,
void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, usec_t timeout_warn_usec);
/* Cleanup functions */
DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_event*, udev_event_unref);
DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_event*, udev_event_free);
DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_rules*, udev_rules_unref);

View File

@ -89,7 +89,7 @@ static int parse_argv(int argc, char *argv[]) {
int test_main(int argc, char *argv[], void *userdata) {
_cleanup_(udev_rules_unrefp) struct udev_rules *rules = NULL;
_cleanup_(udev_device_unrefp) struct udev_device *dev = NULL;
_cleanup_(udev_event_unrefp) struct udev_event *event = NULL;
_cleanup_(udev_event_freep) struct udev_event *event = NULL;
struct udev_list_entry *entry;
sigset_t mask, sigmask_orig;
const char *cmd;

View File

@ -398,7 +398,7 @@ static void worker_spawn(Manager *manager, struct event *event) {
write_string_file("/proc/self/oom_score_adj", "0", 0);
for (;;) {
struct udev_event *udev_event;
_cleanup_(udev_event_freep) struct udev_event *udev_event = NULL;
int fd_lock = -1;
assert(dev);
@ -477,8 +477,6 @@ skip:
udev_device_unref(dev);
dev = NULL;
udev_event_unref(udev_event);
/* wait for more device messages from main udevd, or term signal */
while (dev == NULL) {
struct epoll_event ev[4];