diff options
author | Josh Rickmar <jrick@devio.us> | 2012-06-29 12:57:33 -0400 |
---|---|---|
committer | Josh Rickmar <jrick@devio.us> | 2012-06-29 12:57:33 -0400 |
commit | aa2c11c21e9eba26b73ea92f96cc290552b58589 (patch) | |
tree | de2aef00d23622558c718d83f965b0ffd838bae2 /linux | |
parent | 0f1459a32765c392f24c97892bf0ba908d8a1f23 (diff) | |
download | xombrero-aa2c11c21e9eba26b73ea92f96cc290552b58589.tar.gz |
Import the latest OpenBSD tree.h, as we make calls to RB_FOREACH_SAFE, which the old one did not have.
Diffstat (limited to 'linux')
-rw-r--r-- | linux/tree.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/linux/tree.h b/linux/tree.h index 30c62b6..80d0f53 100644 --- a/linux/tree.h +++ b/linux/tree.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tree.h,v 1.12 2009/03/02 09:42:55 mikeb Exp $ */ +/* $OpenBSD: tree.h,v 1.13 2011/07/09 00:19:45 pirofti Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -730,9 +730,19 @@ name##_RB_MINMAX(struct name *head, int val) \ (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), 1); \ + (x) = (y)) + #define RB_FOREACH_REVERSE(x, name, head) \ for ((x) = RB_MAX(name, head); \ (x) != NULL; \ (x) = name##_RB_PREV(x)) +#define RB_FOREACH_REVERSE_SAFE(x, name, head, y) \ + for ((x) = RB_MAX(name, head); \ + ((x) != NULL) && ((y) = name##_RB_PREV(x), 1); \ + (x) = (y)) + #endif /* _SYS_TREE_H_ */ |