Date: Wed, 24 Dec 2008 19:57:22 +0000 (UTC) From: Bruce M Simpson <bms@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r186479 - head/sys/sys Message-ID: <200812241957.mBOJvMO2046447@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bms Date: Wed Dec 24 19:57:22 2008 New Revision: 186479 URL: http://svn.freebsd.org/changeset/base/186479 Log: Add macro RB_FOREACH_SAFE(), which accepts an additional argument specifying a temporary tree node pointer. It may be used in a similar way to the *_SAFE() macros in <sys/queue.h>. Modified: head/sys/sys/tree.h Modified: head/sys/sys/tree.h ============================================================================== --- head/sys/sys/tree.h Wed Dec 24 11:12:21 2008 (r186478) +++ head/sys/sys/tree.h Wed Dec 24 19:57:22 2008 (r186479) @@ -737,6 +737,11 @@ name##_RB_MINMAX(struct name *head, int (x) != NULL; \ (x) = name##_RB_NEXT(x)) +#define RB_FOREACH_SAFE(x, name, head, y) \ + for ((x) = RB_MIN(name, head); \ + (x) != NULL && ((y) = name##_RB_NEXT(x)); \ + (x) = (y)) + #define RB_FOREACH_REVERSE(x, name, head) \ for ((x) = RB_MAX(name, head); \ (x) != NULL; \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812241957.mBOJvMO2046447>