Skip to content

Commit

Permalink
zbus: Use section iterator for observations
Browse files Browse the repository at this point in the history
Iterating the observations can be simplified to a struct iterator instead
of first getting the count and looping afterwards.

Signed-off-by: Pieter De Gendt <[email protected]>
  • Loading branch information
pdgendt authored and aescolar committed Jul 9, 2024
1 parent 058bfc8 commit 9d88818
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions subsys/zbus/zbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,7 @@ static inline void chan_update_hop(const struct zbus_channel *chan)

static inline void update_all_channels_hop(const struct zbus_observer *obs)
{
struct zbus_channel_observation *observation;

int count;

STRUCT_SECTION_COUNT(zbus_channel_observation, &count);

for (int16_t i = 0; i < count; ++i) {
STRUCT_SECTION_GET(zbus_channel_observation, i, &observation);

STRUCT_SECTION_FOREACH(zbus_channel_observation, observation) {
if (obs != observation->obs) {
continue;
}
Expand Down

0 comments on commit 9d88818

Please sign in to comment.