summaryrefslogtreecommitdiffstats
path: root/src/libudev/libudev-queue.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-08-24 06:39:46 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-09-11 05:45:21 +0200
commitccda7f87f5528e3fa697138b9ad334a25e45bce4 (patch)
treed1240934e2b8d461c8cb3165f3ecf4b204c03677 /src/libudev/libudev-queue.c
parentlibudev: modernize code a bit (diff)
downloadsystemd-ccda7f87f5528e3fa697138b9ad334a25e45bce4.tar.xz
systemd-ccda7f87f5528e3fa697138b9ad334a25e45bce4.zip
libudev-queue: use structured initializer
Diffstat (limited to '')
-rw-r--r--src/libudev/libudev-queue.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/libudev/libudev-queue.c b/src/libudev/libudev-queue.c
index 4c60c886e7..a62ba5ebfe 100644
--- a/src/libudev/libudev-queue.c
+++ b/src/libudev/libudev-queue.c
@@ -41,19 +41,21 @@ struct udev_queue {
*
* Returns: the udev queue context, or #NULL on error.
**/
-_public_ struct udev_queue *udev_queue_new(struct udev *udev)
-{
+_public_ struct udev_queue *udev_queue_new(struct udev *udev) {
struct udev_queue *udev_queue;
- udev_queue = new0(struct udev_queue, 1);
+ udev_queue = new(struct udev_queue, 1);
if (udev_queue == NULL) {
errno = ENOMEM;
return NULL;
}
- udev_queue->n_ref = 1;
- udev_queue->udev = udev;
- udev_queue->fd = -1;
+ *udev_queue = (struct udev_queue) {
+ .udev = udev,
+ .n_ref = 1,
+ .fd = -1,
+ };
+
return udev_queue;
}