diff options
author | Tiago Cunha <tcunha@gmx.com> | 2012-05-03 20:39:42 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2012-05-03 20:39:42 +0000 |
commit | b74b875f25943c20a45380ef8aad6fb9d3b4bed6 (patch) | |
tree | f1d321c5974dbecf53fac124f1384df5360a5d8e | |
parent | e79c6470524aeadabb1d9c43e9a5a696a39f455f (diff) | |
download | rtmux-b74b875f25943c20a45380ef8aad6fb9d3b4bed6.tar.gz rtmux-b74b875f25943c20a45380ef8aad6fb9d3b4bed6.tar.bz2 rtmux-b74b875f25943c20a45380ef8aad6fb9d3b4bed6.zip |
Sync OpenBSD tree.h due to patchset 1104.
Prompted by ore on #tmux.
-rw-r--r-- | compat/tree.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/compat/tree.h b/compat/tree.h index 4facaa3e..73041340 100644 --- a/compat/tree.h +++ b/compat/tree.h @@ -1,5 +1,5 @@ /* $Id$ */ -/* $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. @@ -84,7 +84,7 @@ struct { \ SPLAY_RIGHT(tmp, field) = (head)->sph_root; \ (head)->sph_root = tmp; \ } while (0) - + #define SPLAY_ROTATE_LEFT(head, tmp, field) do { \ SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field); \ SPLAY_LEFT(tmp, field) = (head)->sph_root; \ @@ -731,9 +731,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_ */ |