diff options
Diffstat (limited to 'openbsd-compat/sys-tree.h')
-rw-r--r-- | openbsd-compat/sys-tree.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/openbsd-compat/sys-tree.h b/openbsd-compat/sys-tree.h index c80b90b21..d4949b5e7 100644 --- a/openbsd-compat/sys-tree.h +++ b/openbsd-compat/sys-tree.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tree.h,v 1.7 2002/10/17 21:51:54 art Exp $ */ | 1 | /* $OpenBSD: tree.h,v 1.10 2007/10/29 23:49:41 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> | 3 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> |
4 | * All rights reserved. | 4 | * All rights reserved. |
@@ -289,7 +289,7 @@ void name##_SPLAY_MINMAX(struct name *head, int __comp) \ | |||
289 | (x) != NULL; \ | 289 | (x) != NULL; \ |
290 | (x) = SPLAY_NEXT(name, head, x)) | 290 | (x) = SPLAY_NEXT(name, head, x)) |
291 | 291 | ||
292 | /* Macros that define a red-back tree */ | 292 | /* Macros that define a red-black tree */ |
293 | #define RB_HEAD(name, type) \ | 293 | #define RB_HEAD(name, type) \ |
294 | struct name { \ | 294 | struct name { \ |
295 | struct type *rbh_root; /* root of the tree */ \ | 295 | struct type *rbh_root; /* root of the tree */ \ |
@@ -381,9 +381,9 @@ void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\ | |||
381 | struct type *name##_RB_REMOVE(struct name *, struct type *); \ | 381 | struct type *name##_RB_REMOVE(struct name *, struct type *); \ |
382 | struct type *name##_RB_INSERT(struct name *, struct type *); \ | 382 | struct type *name##_RB_INSERT(struct name *, struct type *); \ |
383 | struct type *name##_RB_FIND(struct name *, struct type *); \ | 383 | struct type *name##_RB_FIND(struct name *, struct type *); \ |
384 | struct type *name##_RB_NEXT(struct name *, struct type *); \ | 384 | struct type *name##_RB_NEXT(struct type *); \ |
385 | struct type *name##_RB_MINMAX(struct name *, int); \ | 385 | struct type *name##_RB_MINMAX(struct name *, int); |
386 | \ | 386 | |
387 | 387 | ||
388 | /* Main rb operation. | 388 | /* Main rb operation. |
389 | * Moves node close to the key of elm to top | 389 | * Moves node close to the key of elm to top |
@@ -626,7 +626,7 @@ name##_RB_FIND(struct name *head, struct type *elm) \ | |||
626 | } \ | 626 | } \ |
627 | \ | 627 | \ |
628 | struct type * \ | 628 | struct type * \ |
629 | name##_RB_NEXT(struct name *head, struct type *elm) \ | 629 | name##_RB_NEXT(struct type *elm) \ |
630 | { \ | 630 | { \ |
631 | if (RB_RIGHT(elm, field)) { \ | 631 | if (RB_RIGHT(elm, field)) { \ |
632 | elm = RB_RIGHT(elm, field); \ | 632 | elm = RB_RIGHT(elm, field); \ |
@@ -667,13 +667,13 @@ name##_RB_MINMAX(struct name *head, int val) \ | |||
667 | #define RB_INSERT(name, x, y) name##_RB_INSERT(x, y) | 667 | #define RB_INSERT(name, x, y) name##_RB_INSERT(x, y) |
668 | #define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y) | 668 | #define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y) |
669 | #define RB_FIND(name, x, y) name##_RB_FIND(x, y) | 669 | #define RB_FIND(name, x, y) name##_RB_FIND(x, y) |
670 | #define RB_NEXT(name, x, y) name##_RB_NEXT(x, y) | 670 | #define RB_NEXT(name, x, y) name##_RB_NEXT(y) |
671 | #define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF) | 671 | #define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF) |
672 | #define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF) | 672 | #define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF) |
673 | 673 | ||
674 | #define RB_FOREACH(x, name, head) \ | 674 | #define RB_FOREACH(x, name, head) \ |
675 | for ((x) = RB_MIN(name, head); \ | 675 | for ((x) = RB_MIN(name, head); \ |
676 | (x) != NULL; \ | 676 | (x) != NULL; \ |
677 | (x) = name##_RB_NEXT(head, x)) | 677 | (x) = name##_RB_NEXT(x)) |
678 | 678 | ||
679 | #endif /* _SYS_TREE_H_ */ | 679 | #endif /* _SYS_TREE_H_ */ |