+#define tracker_packet_for_each_dest(mcast_entry, dest_entry, mcast_num, dest_num, tracker_packet) \
- for (mcast_num = 0, mcast_entry = (struct mcast_entry *)(tracker_packet + 1), \
dest_entry = (uint8_t *)(mcast_entry + 1); \
mcast_num < tracker_packet->num_mcast_entries; mcast_num++, \
mcast_entry = (struct mcast_entry *)dest_entry, \
dest_entry = (uint8_t *)(mcast_entry + 1)) \
for (dest_num = 0; dest_num < mcast_entry->num_dest; dest_num++, \
dest_entry += ETH_ALEN)
It is probably not a good idea to have nested for loops inside a macro like this. What happens with code like:
tracker_packet_for_each_dest(mcast_entry, dest_entry, mcast_num, dest_num, tracker_packet) { ... ... if (foo == bar) break;
if (foo) continue;
These don't do what you would expect.
Andrew