diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-05-09 08:57:36 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-05-10 13:06:32 +0200 |
commit | b456b09b25bf92357ee04f6586a5915a02622467 (patch) | |
tree | d5abc4ecfcc90c3c306e8088cb2c83b9eb454c86 | |
parent | resolve: reallocate DNS scope when DNSSEC and/or DNS-over-TLS settings are ch... (diff) | |
download | systemd-b456b09b25bf92357ee04f6586a5915a02622467.tar.xz systemd-b456b09b25bf92357ee04f6586a5915a02622467.zip |
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.
-rw-r--r-- | src/fuzz/fuzz-calendarspec.c | 1 | ||||
-rw-r--r-- | src/shared/calendarspec.c | 8 | ||||
-rw-r--r-- | src/shared/calendarspec.h | 1 |
3 files changed, 2 insertions, 8 deletions
diff --git a/src/fuzz/fuzz-calendarspec.c b/src/fuzz/fuzz-calendarspec.c index 80801723fd..07d3fbca7f 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 7dfb50b98d..369cb2f081 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 3bfe82d7f6..d756efcdb7 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); |