chore: switch to defualt clang-format formatting

remotes/1725063243225097762/tmp_refs/heads/main
Jef Roosens 2023-01-18 11:38:34 +01:00
parent 4d72e60515
commit be97472dcc
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
4 changed files with 319 additions and 314 deletions

View File

@ -5,6 +5,7 @@ SRC_DIR ?= src
INC_DIRS ?= include INC_DIRS ?= include
SRCS != find '$(SRC_DIR)' -iname '*.c' SRCS != find '$(SRC_DIR)' -iname '*.c'
SRCS_H != find $(INC_DIRS) -iname '*.h'
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o) OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
DEPS := $(SRCS:%=$(BUILD_DIR)/%.d) DEPS := $(SRCS:%=$(BUILD_DIR)/%.d)
@ -32,6 +33,15 @@ $(BUILD_DIR)/%.c.o: %.c
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
# =====MAINTENANCE=====
.PHONY: lint
lint:
clang-format -n --Werror $(SRCS) $(SRCS_H)
.PHONY: fmt
fmt:
clang-format -i $(SRCS) $(SRCS_H)
.PHONY: clean .PHONY: clean
clean: clean:
rm -rf $(BUILD_DIR) rm -rf $(BUILD_DIR)

View File

@ -34,20 +34,17 @@ void ce_next(cron_simple_time *out, cron_expression *ce,
month_index++; month_index++;
} }
if (month_index < ce->month_count && if (month_index < ce->month_count && ref->month == ce->months[month_index]) {
ref->month == ce->months[month_index]) {
while (day_index < ce->day_count && ref->day > ce->days[day_index]) { while (day_index < ce->day_count && ref->day > ce->days[day_index]) {
day_index++; day_index++;
} }
if (day_index < ce->day_count && ref->day == ce->days[day_index]) { if (day_index < ce->day_count && ref->day == ce->days[day_index]) {
while (hour_index < ce->hour_count && while (hour_index < ce->hour_count && ref->hour > ce->hours[hour_index]) {
ref->hour > ce->hours[hour_index]) {
hour_index++; hour_index++;
} }
if (hour_index < ce->hour_count && if (hour_index < ce->hour_count && ref->hour == ce->hours[hour_index]) {
ref->hour == ce->hours[hour_index]) {
// Minute is the only value where we explicitely make sure we // Minute is the only value where we explicitely make sure we
// can't match sref's value exactly. This is to ensure we only // can't match sref's value exactly. This is to ensure we only
// return values in the future. // return values in the future.

View File

@ -274,8 +274,7 @@ cron_parse_error ce_parse_expression(cron_expression *out,
uint8_t max_day_value = 0; uint8_t max_day_value = 0;
for (uint8_t i = 0; i < out->month_count; i++) { for (uint8_t i = 0; i < out->month_count; i++) {
max_day_value = max_day_value = MAX(max_day_value, parse_month_days[out->months[i] - 1]);
MAX(max_day_value, parse_month_days[out->months[i] - 1]);
} }
// Days // Days
@ -290,8 +289,7 @@ cron_parse_error ce_parse_expression(cron_expression *out,
goto end; goto end;
} }
out->day_count = out->day_count = bf_to_nums(&out->days, bit_field, min[2], max_day_value);
bf_to_nums(&out->days, bit_field, min[2], max_day_value);
} }
// If days aren't provided, they're replaced with a * // If days aren't provided, they're replaced with a *
else { else {