diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-06-28 18:37:34 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-07-02 12:46:16 +0200 |
commit | 64903d18dfd0344d5af3c0f8006b2e220de90091 (patch) | |
tree | f6ed4047b5d324adb513115fc9315ce25aaec5af /src/libsystemd/sd-event | |
parent | a4d60b3e1c2097c3e23084aed401e3529b138df1 (diff) | |
download | systemd-64903d18dfd0344d5af3c0f8006b2e220de90091.tar.gz |
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 'src/libsystemd/sd-event')
-rw-r--r-- | src/libsystemd/sd-event/sd-event.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c index a37147d1d5..5833a83346 100644 --- a/src/libsystemd/sd-event/sd-event.c +++ b/src/libsystemd/sd-event/sd-event.c @@ -1799,7 +1799,7 @@ static void event_free_inode_data( if (!d) return; - assert(LIST_IS_EMPTY(d->event_sources)); + assert(!d->event_sources); if (d->fd >= 0) { LIST_REMOVE(to_close, e->inode_data_to_close, d); @@ -1862,7 +1862,7 @@ static void event_gc_inode_data( if (!d) return; - if (!LIST_IS_EMPTY(d->event_sources)) + if (d->event_sources) return; inotify_data = d->inotify_data; @@ -3874,7 +3874,7 @@ _public_ int sd_event_prepare(sd_event *e) { event_close_inode_data_fds(e); - if (event_next_pending(e) || e->need_process_child || !LIST_IS_EMPTY(e->inotify_data_buffered)) + if (event_next_pending(e) || e->need_process_child || e->inotify_data_buffered) goto pending; e->state = SD_EVENT_ARMED; @@ -3954,7 +3954,7 @@ static int process_epoll(sd_event *e, usec_t timeout, int64_t threshold, int64_t n_event_max = MALLOC_ELEMENTSOF(e->event_queue); /* If we still have inotify data buffered, then query the other fds, but don't wait on it */ - if (!LIST_IS_EMPTY(e->inotify_data_buffered)) + if (e->inotify_data_buffered) timeout = 0; for (;;) { |