1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00

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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2022-05-09 08:57:36 +02:00
parent 16f74783d8
commit b456b09b25
3 changed files with 2 additions and 8 deletions

View 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);
}

View 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;

View 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);