summaryrefslogtreecommitdiff
path: root/src/basic/io-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-03-18 14:19:20 +0100
committerLennart Poettering <lennart@poettering.net>2022-03-18 17:13:36 +0100
commit52bb308c138dd1006078370c93e0e77dfc61de73 (patch)
treee7f604afa7a057a78fb65f383fa5e723f9ab614d /src/basic/io-util.c
parentde0988f9d2b23580d31e857991337927a5735fe1 (diff)
downloadsystemd-52bb308c138dd1006078370c93e0e77dfc61de73.tar.gz
time-util: add macros around timespec_store() that operates on compund literal allocated timespec struct
This way we can convert usec_t to timespec on-the-fly, without a buffer. No actual behaviour change just some shortening of code.
Diffstat (limited to 'src/basic/io-util.c')
-rw-r--r--src/basic/io-util.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/basic/io-util.c b/src/basic/io-util.c
index 783ca1309d..a591a75c37 100644
--- a/src/basic/io-util.c
+++ b/src/basic/io-util.c
@@ -159,7 +159,6 @@ int pipe_eof(int fd) {
}
int ppoll_usec(struct pollfd *fds, size_t nfds, usec_t timeout) {
- struct timespec ts;
int r;
assert(fds || nfds == 0);
@@ -167,7 +166,7 @@ int ppoll_usec(struct pollfd *fds, size_t nfds, usec_t timeout) {
if (nfds == 0)
return 0;
- r = ppoll(fds, nfds, timeout == USEC_INFINITY ? NULL : timespec_store(&ts, timeout), NULL);
+ r = ppoll(fds, nfds, timeout == USEC_INFINITY ? NULL : TIMESPEC_STORE(timeout), NULL);
if (r < 0)
return -errno;
if (r == 0)