From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Wed, 8 Dec 2010 10:06:37 +0100 From: Andrew Lunn Message-ID: <20101208090637.GC11450@lunn.ch> References: <20101207221351.GA19474@Sellars> <1291761150-29818-7-git-send-email-linus.luessing@saxnet.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1291761150-29818-7-git-send-email-linus.luessing@saxnet.de> Subject: Re: [B.A.T.M.A.N.] [PATCH 07/20] batman-adv: Prepare and send own multicast tracker packets Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: The list for a Better Approach To Mobile Ad-hoc Networking Cc: Linus L??ssing > +#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