[systemd-devel] [PATCH 5/7] calendar: re-ordering 'weekly'

Daniele Medri dmedri at gmail.com
Mon Oct 27 00:42:43 PDT 2014


---
 src/shared/calendarspec.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/shared/calendarspec.c b/src/shared/calendarspec.c
index 6186301..fae7dfd 100644
--- a/src/shared/calendarspec.c
+++ b/src/shared/calendarspec.c
@@ -857,10 +857,10 @@ int calendar_spec_from_string(const char *p, CalendarSpec **spec) {
                 if (r < 0)
                         goto fail;
 
-        } else if (strcaseeq(p, "monthly")) {
-                r = const_chain(1, &c->day);
-                if (r < 0)
-                        goto fail;
+        } else if (strcaseeq(p, "weekly")) {
+
+                c->weekdays_bits = 1;
+
                 r = const_chain(0, &c->hour);
                 if (r < 0)
                         goto fail;
@@ -871,11 +871,7 @@ int calendar_spec_from_string(const char *p, CalendarSpec **spec) {
                 if (r < 0)
                         goto fail;
 
-        } else if (strcaseeq(p, "annually") || strcaseeq(p, "yearly")
-                   || strcaseeq(p, "anually") /* backwards compatibility */ ) {
-                r = const_chain(1, &c->month);
-                if (r < 0)
-                        goto fail;
+        } else if (strcaseeq(p, "monthly")) {
                 r = const_chain(1, &c->day);
                 if (r < 0)
                         goto fail;
@@ -889,10 +885,14 @@ int calendar_spec_from_string(const char *p, CalendarSpec **spec) {
                 if (r < 0)
                         goto fail;
 
-        } else if (strcaseeq(p, "weekly")) {
-
-                c->weekdays_bits = 1;
-
+        } else if (strcaseeq(p, "annually") || strcaseeq(p, "yearly")
+                   || strcaseeq(p, "anually") /* backwards compatibility */ ) {
+                r = const_chain(1, &c->month);
+                if (r < 0)
+                        goto fail;
+                r = const_chain(1, &c->day);
+                if (r < 0)
+                        goto fail;
                 r = const_chain(0, &c->hour);
                 if (r < 0)
                         goto fail;
-- 
1.9.3



More information about the systemd-devel mailing list