[systemd-commits] 2 commits - TODO src/shared src/timesync

Lennart Poettering lennart at kemper.freedesktop.org
Tue May 6 04:07:21 PDT 2014


 TODO                     |    1 -
 src/shared/list.h        |   22 ++++++++++++++--------
 src/timesync/timesyncd.c |    9 +++------
 3 files changed, 17 insertions(+), 15 deletions(-)

New commits:
commit 376cd3b89c62f580a6f576cecfbbb28d3944118f
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue May 6 13:07:15 2014 +0200

    list: make LIST_FIND_TAIL work for empty lists

diff --git a/src/shared/list.h b/src/shared/list.h
index e55b91c..c020f7e 100644
--- a/src/shared/list.h
+++ b/src/shared/list.h
@@ -75,20 +75,26 @@
 #define LIST_FIND_HEAD(name,item,head)                                  \
         do {                                                            \
                 typeof(*(item)) *_item = (item);                        \
-                assert(_item);                                          \
-                while (_item->name##_prev)                              \
-                       _item = _item->name##_prev;                      \
-                (head) = _item;                                         \
+                if (!_item)                                             \
+                        (head) = NULL;                                  \
+                else {                                                  \
+                        while (_item->name##_prev)                      \
+                                _item = _item->name##_prev;             \
+                        (head) = _item;                                 \
+                }                                                       \
         } while (false)
 
 /* Find the tail of the list */
 #define LIST_FIND_TAIL(name,item,tail)                                  \
         do {                                                            \
                 typeof(*(item)) *_item = (item);                        \
-                assert(_item);                                          \
-                while (_item->name##_next)                              \
-                        _item = _item->name##_next;                     \
-                (tail) = _item;                                         \
+                if (!_item)                                             \
+                        (tail) = NULL;                                  \
+                else {                                                  \
+                        while (_item->name##_next)                      \
+                                _item = _item->name##_next;             \
+                        (tail) = _item;                                 \
+                }                                                       \
         } while (false)
 
 /* Insert an item after another one (a = where, b = what) */
diff --git a/src/timesync/timesyncd.c b/src/timesync/timesyncd.c
index 1c0f113..fa9671d 100644
--- a/src/timesync/timesyncd.c
+++ b/src/timesync/timesyncd.c
@@ -335,7 +335,7 @@ static int manager_clock_watch_setup(Manager *m) {
         assert(m);
 
         m->event_clock_watch = sd_event_source_unref(m->event_clock_watch);
-        m->clock_watch_fd = safe_close(m->clock_watch_fd);
+        safe_close(m->clock_watch_fd);
 
         m->clock_watch_fd = timerfd_create(CLOCK_REALTIME, TFD_NONBLOCK|TFD_CLOEXEC);
         if (m->clock_watch_fd < 0) {
@@ -950,11 +950,8 @@ static int manager_add_server(Manager *m, const char *server) {
                 return -ENOMEM;
         }
 
-        if (m->servers) {
-                LIST_FIND_TAIL(names, m->servers, tail);
-                LIST_INSERT_AFTER(names, m->servers, tail, n);
-        } else
-                LIST_PREPEND(names, m->servers, n);
+        LIST_FIND_TAIL(names, m->servers, tail);
+        LIST_INSERT_AFTER(names, m->servers, tail, n);
 
         return 0;
 }

commit 2db3e2023d1af9eab6ebecddbf64812be2b104f5
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue May 6 13:04:29 2014 +0200

    update TODO

diff --git a/TODO b/TODO
index 89006a5..9aeede1 100644
--- a/TODO
+++ b/TODO
@@ -36,7 +36,6 @@ Features:
   - config file
   - reconnect on reply timeout
   - hookup with networkd: dhcp, listen to online/offline state
-  - res_init()
 
 * a way for container managers to turn off getty starting via $container_headless= or so...
 



More information about the systemd-commits mailing list