]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/calendarspec: make function static void
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 9 May 2022 06:57:36 +0000 (08:57 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 10 May 2022 11:06:32 +0000 (13:06 +0200)
calendar_spec_from_string() already calls calendar_spec_normalize(), so
there is no point in calling it from the fuzzer. Once that's removed, there's
just one internal caller and it can be made static.

src/fuzz/fuzz-calendarspec.c
src/shared/calendarspec.c
src/shared/calendarspec.h

index 80801723fdda42cd552dd6b6b4374138c256ff89..07d3fbca7f053dad7de68ff8e051dc1eb56c02ba 100644 (file)
@@ -16,7 +16,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
 
         if (calendar_spec_from_string(str, &cspec) >= 0) {
                 (void) calendar_spec_valid(cspec);
-                (void) calendar_spec_normalize(cspec);
                 (void) calendar_spec_to_string(cspec, &p);
         }
 
index 7dfb50b98de383fbf83142a08ffc51d1cc96b4c4..369cb2f0815d3ac84c1022ad27aeba9794f608c8 100644 (file)
@@ -145,7 +145,7 @@ static void fix_year(CalendarComponent *c) {
         }
 }
 
-int calendar_spec_normalize(CalendarSpec *c) {
+static void calendar_spec_normalize(CalendarSpec *c) {
         assert(c);
 
         if (streq_ptr(c->timezone, "UTC")) {
@@ -167,8 +167,6 @@ int calendar_spec_normalize(CalendarSpec *c) {
         normalize_chain(&c->hour);
         normalize_chain(&c->minute);
         normalize_chain(&c->microsecond);
-
-        return 0;
 }
 
 static bool chain_valid(CalendarComponent *c, int from, int to, bool end_of_month) {
@@ -1086,9 +1084,7 @@ int calendar_spec_from_string(const char *p, CalendarSpec **spec) {
                         return -EINVAL;
         }
 
-        r = calendar_spec_normalize(c);
-        if (r < 0)
-                return r;
+        calendar_spec_normalize(c);
 
         if (!calendar_spec_valid(c))
                 return -EINVAL;
index 3bfe82d7f60c0173d218d172a8cb3c997ff1fe32..d756efcdb799e4f82b2d97f53c26d8f0515a55de 100644 (file)
@@ -35,7 +35,6 @@ typedef struct CalendarSpec {
 
 CalendarSpec* calendar_spec_free(CalendarSpec *c);
 
-int calendar_spec_normalize(CalendarSpec *spec);
 bool calendar_spec_valid(CalendarSpec *spec);
 
 int calendar_spec_to_string(const CalendarSpec *spec, char **p);