chiark / gitweb /
Use initalization instead of explicit zeroing
[elogind.git] / src / core / swap.c
index dc98f473871114cac7e5b558bc4111e988910c66..b363c5ec092b2814dfbfbbc91f4445eb967499c2 100644 (file)
@@ -1242,10 +1242,14 @@ static void swap_shutdown(Manager *m) {
 
 static int swap_enumerate(Manager *m) {
         int r;
-        struct epoll_event ev;
         assert(m);
 
         if (!m->proc_swaps) {
+                struct epoll_event ev = {
+                        .events = EPOLLPRI,
+                        .data.ptr = &m->swap_watch,
+                };
+
                 m->proc_swaps = fopen("/proc/swaps", "re");
                 if (!m->proc_swaps)
                         return (errno == ENOENT) ? 0 : -errno;
@@ -1253,10 +1257,6 @@ static int swap_enumerate(Manager *m) {
                 m->swap_watch.type = WATCH_SWAP;
                 m->swap_watch.fd = fileno(m->proc_swaps);
 
-                zero(ev);
-                ev.events = EPOLLPRI;
-                ev.data.ptr = &m->swap_watch;
-
                 if (epoll_ctl(m->epoll_fd, EPOLL_CTL_ADD, m->swap_watch.fd, &ev) < 0)
                         return -errno;
         }