From owner-cvs-all Fri Jan 4 13: 8: 7 2002 Delivered-To: cvs-all@freebsd.org Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by hub.freebsd.org (Postfix) with ESMTP id 45BD837B41D; Fri, 4 Jan 2002 13:08:01 -0800 (PST) Received: by flood.ping.uio.no (Postfix, from userid 2602) id 55F5D14C53; Fri, 4 Jan 2002 22:07:59 +0100 (CET) X-URL: http://www.ofug.org/~des/ X-Disclaimer: The views expressed in this message do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. To: "Justin T. Gibbs" Cc: Julian Elischer , Poul-Henning Kamp , Stephen McKay , John Baldwin , cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, Julian Elischer , Greg Lehey Subject: Re: cvs commit: src/share/man/man3 queue.3 References: <200201041552.g04FqWg89682@aslan.scsiguy.com> From: Dag-Erling Smorgrav Date: 04 Jan 2002 22:07:58 +0100 In-Reply-To: <200201041552.g04FqWg89682@aslan.scsiguy.com> Message-ID: Lines: 14 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --=-=-= "Justin T. Gibbs" writes: > Any foreach macro must test the termination condition. If we decided > to define that the element pointer == NULL for a complete traversal, this > would be at most a single assignment within the the termination > conditional. Like the attached patch, you mean? DES -- Dag-Erling Smorgrav - des@ofug.org --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=circleq.diff Index: queue.h =================================================================== RCS file: /home/ncvs/src/sys/sys/queue.h,v retrieving revision 1.32.2.6 diff -u -r1.32.2.6 queue.h --- queue.h 18 Dec 2001 10:09:02 -0000 1.32.2.6 +++ queue.h 4 Jan 2002 21:06:41 -0000 @@ -439,12 +439,12 @@ #define CIRCLEQ_FOREACH(var, head, field) \ for ((var) = CIRCLEQ_FIRST((head)); \ - (var) != (void *)(head); \ + (var) != (void *)(head) || ((var) = NULL); \ (var) = CIRCLEQ_NEXT((var), field)) #define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ for ((var) = CIRCLEQ_LAST((head)); \ - (var) != (void *)(head); \ + (var) != (void *)(head) || ((var) = NULL); \ (var) = CIRCLEQ_PREV((var), field)) #define CIRCLEQ_INIT(head) do { \ --=-=-=-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message