From 58b58806f35022abbf154a9ea2dd3fece34cceb7 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 14 Jan 2023 21:19:29 +0100 Subject: [PATCH] fix: should now compile with gcc --- Makefile | 5 ++++- src/cron/c/parse.c | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3571d30..cbf0fe9 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,9 @@ # =====CONFIG===== SRC_DIR := src -SOURCES != find '$(SRC_DIR)' -\( -iname '*.v' -or -iname '*.h' -or -iname '*.c' -\) +SRCS_C != find '$(SRC_DIR)' -iname '*.c' +SRCS_H != find '$(SRC_DIR)' -iname '*.h' +SRCS_V != find '$(SRC_DIR)' -iname '*.v' +SOURCES := $(SRCS_C) $(SRCS_H) $(SRCS_V) V_PATH ?= v V := $(V_PATH) -showcc -gc boehm -W -d use_openssl -skip-unused diff --git a/src/cron/c/parse.c b/src/cron/c/parse.c index 7a66200..49253bc 100644 --- a/src/cron/c/parse.c +++ b/src/cron/c/parse.c @@ -1,6 +1,7 @@ #include "expression.h" -const uint8_t month_days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; +// This prefix is needed to properly compile +const uint8_t parse_month_days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; // Allowed value ranges for the minute, hour, day and month field const uint8_t min[4] = {0, 0, 1, 1}; @@ -245,7 +246,7 @@ enum cron_parse_error ce_parse_expression(cron_expression *out, char *s) { uint8_t max_day_value = 0; for (uint8_t i = 0; i < out->month_count; i++) { - max_day_value = MAX(max_day_value, month_days[out->months[i] - 1]); + max_day_value = MAX(max_day_value, parse_month_days[out->months[i] - 1]); } // Days