From: Zbigniew Jędrzejewski-Szmek Date: Mon, 9 May 2022 06:57:36 +0000 (+0200) Subject: shared/calendarspec: make function static void X-Git-Tag: v251-rc3~23^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b456b09b25bf92357ee04f6586a5915a02622467;p=thirdparty%2Fsystemd.git shared/calendarspec: make function static void 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. --- diff --git a/src/fuzz/fuzz-calendarspec.c b/src/fuzz/fuzz-calendarspec.c index 80801723fdd..07d3fbca7f0 100644 --- a/src/fuzz/fuzz-calendarspec.c +++ b/src/fuzz/fuzz-calendarspec.c @@ -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); } diff --git a/src/shared/calendarspec.c b/src/shared/calendarspec.c index 7dfb50b98de..369cb2f0815 100644 --- a/src/shared/calendarspec.c +++ b/src/shared/calendarspec.c @@ -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; diff --git a/src/shared/calendarspec.h b/src/shared/calendarspec.h index 3bfe82d7f60..d756efcdb79 100644 --- a/src/shared/calendarspec.h +++ b/src/shared/calendarspec.h @@ -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);