From owner-freebsd-hackers@FreeBSD.ORG Wed May 1 04:11:05 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9C179F95; Wed, 1 May 2013 04:11:05 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 8E0F31796; Wed, 1 May 2013 04:11:05 +0000 (UTC) Received: from Alfreds-MacBook-Pro-9.local (c-67-180-208-218.hsd1.ca.comcast.net [67.180.208.218]) by elvis.mu.org (Postfix) with ESMTPSA id 9F1171A3C19; Tue, 30 Apr 2013 21:10:59 -0700 (PDT) Message-ID: <518095C0.30605@mu.org> Date: Tue, 30 Apr 2013 21:10:40 -0700 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: Lawrence Stewart Subject: Re: Adding a FOREACH_CONTINUE() variant to queue(3) References: <518092BF.9070105@freebsd.org> In-Reply-To: <518092BF.9070105@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 May 2013 04:11:05 -0000 On 4/30/13 8:57 PM, Lawrence Stewart wrote: > [reposting from freebsd-arch@ - was probably the wrong list] > > Hi all, > > I've had use for these a few times now when wanting to restart a loop at > a previously found element, and wonder if there are any thoughts about > sticking them (and equivalents for other list types) in ? > > Cheers, > Lawrence > > #define TAILQ_FOREACH_CONTINUE(var, head, field) \ > for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \ > (var); \ > (var) = TAILQ_NEXT((var), field)) > > > #define SLIST_FOREACH_CONTINUE(var, head, field) \ > for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \ > (var); \ > (var) = SLIST_NEXT((var), field)) > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > Can you show a few uses please? If it can significantly cut down on extra code it seems wise. -Alfred