Skip to content

Commit f2bf83e

Browse files
committed
Apply code formatting
1 parent c220498 commit f2bf83e

8 files changed

Lines changed: 18 additions & 20 deletions

File tree

include/reactor-uc/queues.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct EventQueue {
3737
void (*heapify)(EventQueue* self, size_t idx);
3838
/** @brief Find an event with the same tag and trigger as @p event, or NULL if not found. */
3939
ArbitraryEvent* (*find_equal_same_tag)(EventQueue* self, AbstractEvent* event);
40-
/** @brief Remove the event equal to @p event from the queue. Returns
40+
/** @brief Remove the event equal to @p event from the queue. Returns
4141
* LF_NOT_FOUND if no such event exists, LF_OK otherwise.
4242
*/
4343
lf_ret_t (*remove)(EventQueue* self, AbstractEvent* event);

include/reactor-uc/scheduler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ struct Scheduler {
5959
void (*prepare_timestep)(Scheduler* self, tag_t tag);
6060

6161
/**
62-
* @brief Cancel a pending event for a `trigger` at `event_time`. Returns
62+
* @brief Cancel a pending event for a `trigger` at `event_time`. Returns
6363
* LF_NOT_FOUND if no matching event exists.
6464
*/
6565
lf_ret_t (*cancel_event)(Scheduler* self, Trigger* trigger, instant_t event_time);
6666

6767
/**
68-
* @brief Replace the payload of a pending event for a `trigger` at
68+
* @brief Replace the payload of a pending event for a `trigger` at
6969
* `event_time`. Returns LF_NOT_FOUND if no matching event exists.
7070
*/
7171
lf_ret_t (*replace_event_payload)(Scheduler* self, Trigger* trigger, instant_t event_time, const void* new_value);

src/action.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ lf_ret_t Action_schedule(Action* self, interval_t offset, const void* value) {
7575
break;
7676

7777
case replace:
78-
if (sched->replace_event_payload(sched, (Trigger*)self,
79-
self->last_event_time, value) == LF_OK) {
78+
if (sched->replace_event_payload(sched, (Trigger*)self, self->last_event_time, value) == LF_OK) {
8079
return LF_OK;
8180
}
8281
/* fallthrough - no existing event, defer to earliest_time */
@@ -90,13 +89,15 @@ lf_ret_t Action_schedule(Action* self, interval_t offset, const void* value) {
9089
}
9190
}
9291

93-
// If the event is scheduled at the current tag, we need to increment the microstep to ensure that the event is scheduled after the currently executing reactions.
92+
// If the event is scheduled at the current tag, we need to increment the microstep to ensure that the event is
93+
// scheduled after the currently executing reactions.
9494
if (lf_tag_compare(tag, base_tag) <= 0) {
9595
tag.time = base_tag.time;
9696
tag.microstep = base_tag.microstep + 1;
9797
}
9898

99-
// Only allocate and copy payload if a new event is actually being scheduled. In the case of "drop" and "replace" policies we don't want to allocate a new payload.
99+
// Only allocate and copy payload if a new event is actually being scheduled. In the case of "drop" and "replace"
100+
// policies we don't want to allocate a new payload.
100101
if (value != NULL) {
101102
ret = self->payload_pool.allocate(&self->payload_pool, &payload);
102103
validate(ret == LF_OK);

src/schedulers/dynamic/scheduler.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,10 +520,11 @@ lf_ret_t Scheduler_cancel_event(Scheduler* self, Trigger* trigger, instant_t eve
520520
return LF_OK;
521521
}
522522

523-
lf_ret_t Scheduler_replace_event_payload(Scheduler* self, Trigger* trigger, instant_t event_time, const void* new_value) {
523+
lf_ret_t Scheduler_replace_event_payload(Scheduler* self, Trigger* trigger, instant_t event_time,
524+
const void* new_value) {
524525
DynamicScheduler* scheduler = (DynamicScheduler*)self;
525526
Event* found = find_event(scheduler, trigger, event_time);
526-
527+
527528
if (found == NULL) {
528529
LF_DEBUG(SCHED, "Could not find event to replace payload for trigger %p at time " PRINTF_TIME, trigger, event_time);
529530
return LF_NOT_FOUND;

test/unit/action_defer_test.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@ LF_DEFINE_REACTION_BODY(ActionLib, reaction) {
1717
} else if (self->cnt == 1) {
1818
// First event fires at MSEC(1) with value 41
1919
TEST_ASSERT_EQUAL(true, lf_is_present(act));
20-
TEST_ASSERT_EQUAL(env->scheduler->start_time + MSEC(1),
21-
env->scheduler->current_tag(env->scheduler).time);
20+
TEST_ASSERT_EQUAL(env->scheduler->start_time + MSEC(1), env->scheduler->current_tag(env->scheduler).time);
2221
TEST_ASSERT_EQUAL(41, act->value);
2322
} else if (self->cnt == 2) {
2423
// Deferred event fires at MSEC(6) with value 42
2524
TEST_ASSERT_EQUAL(true, lf_is_present(act));
26-
TEST_ASSERT_EQUAL(env->scheduler->start_time + MSEC(6),
27-
env->scheduler->current_tag(env->scheduler).time);
25+
TEST_ASSERT_EQUAL(env->scheduler->start_time + MSEC(6), env->scheduler->current_tag(env->scheduler).time);
2826
TEST_ASSERT_EQUAL(42, act->value);
2927
}
3028
self->cnt++;

test/unit/action_drop_test.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ LF_DEFINE_REACTION_BODY(ActionLib, reaction) {
1717
} else if (self->cnt >= 1) {
1818
// Only the first event fires at MSEC(1) with value 41
1919
TEST_ASSERT_EQUAL(true, lf_is_present(act));
20-
TEST_ASSERT_EQUAL(env->scheduler->start_time + MSEC(1),
21-
env->scheduler->current_tag(env->scheduler).time);
20+
TEST_ASSERT_EQUAL(env->scheduler->start_time + MSEC(1), env->scheduler->current_tag(env->scheduler).time);
2221
TEST_ASSERT_EQUAL(41, act->value);
2322
}
2423
self->cnt++;

test/unit/action_replace_test.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ LF_DEFINE_REACTION_BODY(ActionLib, reaction) {
1717
} else if (self->cnt >= 1) {
1818
// Event fires at MSEC(1) but with replaced value 42
1919
TEST_ASSERT_EQUAL(true, lf_is_present(act));
20-
TEST_ASSERT_EQUAL(env->scheduler->start_time + MSEC(1),
21-
env->scheduler->current_tag(env->scheduler).time);
20+
TEST_ASSERT_EQUAL(env->scheduler->start_time + MSEC(1), env->scheduler->current_tag(env->scheduler).time);
2221
TEST_ASSERT_EQUAL(42, act->value);
2322
}
2423
self->cnt++;

test/unit/action_update_test.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ LF_DEFINE_REACTION_BODY(ActionLib, reaction) {
88
LF_SCOPE_SELF(ActionLib);
99
LF_SCOPE_ENV();
1010
LF_SCOPE_ACTION(ActionLib, act);
11-
printf("Reaction executed at time " PRINTF_TIME ", with value %i\n", env->scheduler->current_tag(env->scheduler).time, act->value);
11+
printf("Reaction executed at time " PRINTF_TIME ", with value %i\n", env->scheduler->current_tag(env->scheduler).time,
12+
act->value);
1213

1314
if (self->cnt == 0) {
1415
// Startup: schedule two events that will violate min_spacing
@@ -18,8 +19,7 @@ LF_DEFINE_REACTION_BODY(ActionLib, reaction) {
1819
} else if (self->cnt >= 1) {
1920
// Event fires at MSEC(2) with value 42 (old event cancelled)
2021
TEST_ASSERT_EQUAL(true, lf_is_present(act));
21-
TEST_ASSERT_EQUAL(env->scheduler->start_time + MSEC(2),
22-
env->scheduler->current_tag(env->scheduler).time);
22+
TEST_ASSERT_EQUAL(env->scheduler->start_time + MSEC(2), env->scheduler->current_tag(env->scheduler).time);
2323
TEST_ASSERT_EQUAL(42, act->value);
2424
}
2525
self->cnt++;

0 commit comments

Comments
 (0)