From e7f2de41ca820746b38bc0525097b667bb51f437 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Wed, 27 Dec 2023 01:01:21 -0500 Subject: [PATCH] Remove useless include/hexagram/table.h --- include/hexagram/schedule.h | 7 ++++--- include/hexagram/table.h | 13 ------------- src/Makefile | 2 +- src/schedule.c | 9 ++++----- 4 files changed, 9 insertions(+), 22 deletions(-) delete mode 100644 include/hexagram/table.h diff --git a/include/hexagram/schedule.h b/include/hexagram/schedule.h index bbbe9e3..8e3c2b6 100644 --- a/include/hexagram/schedule.h +++ b/include/hexagram/schedule.h @@ -6,11 +6,12 @@ #include #include -#include +#include typedef struct _hexagram_schedule_slot { time_t interval_us; - hexagram_table_entry *entry; + hexagram_can_if *iface; + struct can_frame frame; } hexagram_schedule_slot; typedef struct _hexagram_schedule { @@ -24,7 +25,7 @@ typedef struct _hexagram_schedule { int error; } hexagram_schedule; -hexagram_schedule *hexagram_schedule_create(hexagram_table_entry *table, +hexagram_schedule *hexagram_schedule_create(hexagram_schedule_slot *table, size_t count); void hexagram_schedule_destroy(hexagram_schedule *schedule); diff --git a/include/hexagram/table.h b/include/hexagram/table.h deleted file mode 100644 index 054d51c..0000000 --- a/include/hexagram/table.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _HEXAGRAM_TABLE_H -#define _HEXAGRAM_TABLE_H - -#include -#include - -typedef struct _hexagram_table_entry { - time_t freq_us; - hexagram_can_if *iface; - struct can_frame frame; -} hexagram_table_entry; - -#endif /* _HEXAGRAM_TABLE_H */ diff --git a/src/Makefile b/src/Makefile index 110b93e..5654c62 100644 --- a/src/Makefile +++ b/src/Makefile @@ -9,7 +9,7 @@ LDFLAGS = $(shell pkg-config --libs cairo x11) -lXext HEADERS = dict.h hash.h can.h capture.h pcapng.h module.h window.h \ gauge.h tacho.h speedo.h thermo.h fuel.h mfd.h cluster.h \ - sim.h schedule.h table.h + sim.h schedule.h HEADERS_LOCAL = util.h diff --git a/src/schedule.c b/src/schedule.c index aacc0a6..3e2f416 100644 --- a/src/schedule.c +++ b/src/schedule.c @@ -42,7 +42,7 @@ static void _ev_notify(hexagram_schedule *schedule) { hexagram_schedule_slot *slot = _slot(schedule, schedule->current); time_t delay = slot->interval_us; - if (hexagram_can_if_write(slot->entry->iface, &slot->entry->frame) < 0) { + if (hexagram_can_if_write(slot->iface, &slot->frame) < 0) { schedule->error = errno; break; @@ -65,7 +65,7 @@ static void _ev_notify(hexagram_schedule *schedule) { } static int _schedule_init(hexagram_schedule *schedule, - hexagram_table_entry *table, + hexagram_schedule_slot *table, size_t count) { size_t i; @@ -87,8 +87,7 @@ static int _schedule_init(hexagram_schedule *schedule, for (i=0; iinterval_us = table[i].freq_us; - slot->entry = &table[i]; + memcpy(slot, &table[i], sizeof(hexagram_schedule_slot)); } qsort(schedule + 1, count, sizeof(hexagram_schedule_slot), _slot_cmp); @@ -99,7 +98,7 @@ error_timer_create: return -1; } -hexagram_schedule *hexagram_schedule_create(hexagram_table_entry *table, +hexagram_schedule *hexagram_schedule_create(hexagram_schedule_slot *table, size_t count) { hexagram_schedule *schedule;