summaryrefslogtreecommitdiffstats
path: root/src/udev/udevd.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-06-28 18:37:34 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-07-02 12:46:16 +0200
commit64903d18dfd0344d5af3c0f8006b2e220de90091 (patch)
treef6ed4047b5d324adb513115fc9315ce25aaec5af /src/udev/udevd.c
parentMerge pull request #23827 from yuwata/sd-event-process-buffered-inotify-data (diff)
downloadsystemd-64903d18dfd0344d5af3c0f8006b2e220de90091.tar.xz
systemd-64903d18dfd0344d5af3c0f8006b2e220de90091.zip
basic/list: drop LIST_IS_EMPTY
This was a trivial wrapper that didn't provide any added value. With more complicated structures like strvs, hashmaps, sets, and arrays, it is possible to have an empty container. But in case of a list, the list is empty only when the head is missing. Also, we generally want the positive condition, so we replace many if (!LIST_IS_EMPTY(x)) with just if (x).
Diffstat (limited to '')
-rw-r--r--src/udev/udevd.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 1994b6b2d5..d3e949dae4 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -1008,8 +1008,7 @@ static int event_queue_start(Manager *manager) {
assert(manager);
- if (LIST_IS_EMPTY(manager->events) ||
- manager->exit || manager->stop_exec_queue)
+ if (!manager->events || manager->exit || manager->stop_exec_queue)
return 0;
assert_se(sd_event_now(manager->event, CLOCK_MONOTONIC, &usec) >= 0);
@@ -1166,7 +1165,7 @@ static int event_queue_insert(Manager *manager, sd_device *dev) {
.state = EVENT_QUEUED,
};
- if (LIST_IS_EMPTY(manager->events)) {
+ if (!manager->events) {
r = touch("/run/udev/queue");
if (r < 0)
log_warning_errno(r, "Failed to touch /run/udev/queue, ignoring: %m");
@@ -1611,7 +1610,7 @@ static int on_post(sd_event_source *s, void *userdata) {
assert(manager);
- if (!LIST_IS_EMPTY(manager->events)) {
+ if (manager->events) {
/* Try to process pending events if idle workers exist. Why is this necessary?
* When a worker finished an event and became idle, even if there was a pending event,
* the corresponding device might have been locked and the processing of the event