]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
calendarspec: minor refactoring and style fix 4935/head
authorDouglas Christman <DouglasChristman@gmail.com>
Tue, 20 Dec 2016 21:44:01 +0000 (16:44 -0500)
committerDouglas Christman <DouglasChristman@gmail.com>
Tue, 20 Dec 2016 22:52:55 +0000 (17:52 -0500)
src/basic/calendarspec.c

index 1b1acd3e0b92a29853c5cb35e47dd1eb55095d67..2e5622699dc359c52ead5c1d61ad2236b8a17f02 100644 (file)
@@ -510,12 +510,10 @@ static int parse_component_decimal(const char **p, bool usec, int *res) {
                         return -ERANGE;
 
                 value *= USEC_PER_SEC;
-                if (*e == '.') {
-                        unsigned add;
 
-                        /* This is the start of a range, not a fractional part */
-                        if (e[1] == '.')
-                                goto finish;
+                /* One "." is a decimal point, but ".." is a range separator */
+                if (e[0] == '.' && e[1] != '.') {
+                        unsigned add;
 
                         e++;
                         r = parse_fractional_part_u(&e, 6, &add);
@@ -528,7 +526,6 @@ static int parse_component_decimal(const char **p, bool usec, int *res) {
                 }
         }
 
-finish:
         if (value > INT_MAX)
                 return -ERANGE;
 
@@ -1017,8 +1014,7 @@ fail:
         return r;
 }
 
-static int find_end_of_month(struct tm *tm, bool utc, int day)
-{
+static int find_end_of_month(struct tm *tm, bool utc, int day) {
         struct tm t = *tm;
 
         t.tm_mon++;