diff options
author | Damien Miller <djm@mindrot.org> | 2002-09-12 10:43:29 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2002-09-12 10:43:29 +1000 |
commit | 9b481510bb211f6131303d9ec58788b4e2c3a2c4 (patch) | |
tree | a754502d4bcd31aa4b96bbf1381edc1f41c9b3f0 | |
parent | 622accfdb75e5d3705f03bf6b55e37809fdfa777 (diff) |
- (djm) Sync sys/tree.h with OpenBSD -current. Rename tree.h and
fake-queue.h to sys-tree.h and sys-queue.h
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | monitor_mm.h | 2 | ||||
-rw-r--r-- | openbsd-compat/sys-queue.h (renamed from openbsd-compat/fake-queue.h) | 0 | ||||
-rw-r--r-- | openbsd-compat/sys-tree.h (renamed from openbsd-compat/tree.h) | 98 | ||||
-rw-r--r-- | sftp-client.c | 2 | ||||
-rw-r--r-- | ssh-agent.c | 2 | ||||
-rw-r--r-- | ssh-keyscan.c | 2 |
7 files changed, 60 insertions, 50 deletions
@@ -1,6 +1,8 @@ | |||
1 | 20020912 | 1 | 20020912 |
2 | - (djm) Added getpeereid() replacement. Properly implemented for systems | 2 | - (djm) Added getpeereid() replacement. Properly implemented for systems |
3 | with SO_PEERCRED support. Faked for systems which lack it. | 3 | with SO_PEERCRED support. Faked for systems which lack it. |
4 | - (djm) Sync sys/tree.h with OpenBSD -current. Rename tree.h and | ||
5 | fake-queue.h to sys-tree.h and sys-queue.h | ||
4 | - (djm) OpenBSD CVS Sync | 6 | - (djm) OpenBSD CVS Sync |
5 | - markus@cvs.openbsd.org 2002/09/08 20:24:08 | 7 | - markus@cvs.openbsd.org 2002/09/08 20:24:08 |
6 | [hostfile.h] | 8 | [hostfile.h] |
@@ -1651,4 +1653,4 @@ | |||
1651 | - (stevesk) entropy.c: typo in debug message | 1653 | - (stevesk) entropy.c: typo in debug message |
1652 | - (djm) ssh-keygen -i needs seeded RNG; report from markus@ | 1654 | - (djm) ssh-keygen -i needs seeded RNG; report from markus@ |
1653 | 1655 | ||
1654 | $Id: ChangeLog,v 1.2460 2002/09/12 00:34:13 djm Exp $ | 1656 | $Id: ChangeLog,v 1.2461 2002/09/12 00:43:29 djm Exp $ |
diff --git a/monitor_mm.h b/monitor_mm.h index c0a66d5e7..a1323b9a8 100644 --- a/monitor_mm.h +++ b/monitor_mm.h | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | #ifndef _MM_H_ | 28 | #ifndef _MM_H_ |
29 | #define _MM_H_ | 29 | #define _MM_H_ |
30 | #include "openbsd-compat/tree.h" | 30 | #include "openbsd-compat/sys-tree.h" |
31 | 31 | ||
32 | struct mm_share { | 32 | struct mm_share { |
33 | RB_ENTRY(mm_share) next; | 33 | RB_ENTRY(mm_share) next; |
diff --git a/openbsd-compat/fake-queue.h b/openbsd-compat/sys-queue.h index 176fe3174..176fe3174 100644 --- a/openbsd-compat/fake-queue.h +++ b/openbsd-compat/sys-queue.h | |||
diff --git a/openbsd-compat/tree.h b/openbsd-compat/sys-tree.h index 30b4a8561..0a58710c9 100644 --- a/openbsd-compat/tree.h +++ b/openbsd-compat/sys-tree.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* $OpenBSD: tree.h,v 1.6 2002/06/11 22:09:52 provos Exp $ */ | ||
1 | /* | 2 | /* |
2 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> | 3 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> |
3 | * All rights reserved. | 4 | * All rights reserved. |
@@ -113,8 +114,47 @@ struct { \ | |||
113 | #define SPLAY_PROTOTYPE(name, type, field, cmp) \ | 114 | #define SPLAY_PROTOTYPE(name, type, field, cmp) \ |
114 | void name##_SPLAY(struct name *, struct type *); \ | 115 | void name##_SPLAY(struct name *, struct type *); \ |
115 | void name##_SPLAY_MINMAX(struct name *, int); \ | 116 | void name##_SPLAY_MINMAX(struct name *, int); \ |
117 | struct type *name##_SPLAY_INSERT(struct name *, struct type *); \ | ||
118 | struct type *name##_SPLAY_REMOVE(struct name *, struct type *); \ | ||
116 | \ | 119 | \ |
117 | static __inline void \ | 120 | /* Finds the node with the same key as elm */ \ |
121 | static __inline struct type * \ | ||
122 | name##_SPLAY_FIND(struct name *head, struct type *elm) \ | ||
123 | { \ | ||
124 | if (SPLAY_EMPTY(head)) \ | ||
125 | return(NULL); \ | ||
126 | name##_SPLAY(head, elm); \ | ||
127 | if ((cmp)(elm, (head)->sph_root) == 0) \ | ||
128 | return (head->sph_root); \ | ||
129 | return (NULL); \ | ||
130 | } \ | ||
131 | \ | ||
132 | static __inline struct type * \ | ||
133 | name##_SPLAY_NEXT(struct name *head, struct type *elm) \ | ||
134 | { \ | ||
135 | name##_SPLAY(head, elm); \ | ||
136 | if (SPLAY_RIGHT(elm, field) != NULL) { \ | ||
137 | elm = SPLAY_RIGHT(elm, field); \ | ||
138 | while (SPLAY_LEFT(elm, field) != NULL) { \ | ||
139 | elm = SPLAY_LEFT(elm, field); \ | ||
140 | } \ | ||
141 | } else \ | ||
142 | elm = NULL; \ | ||
143 | return (elm); \ | ||
144 | } \ | ||
145 | \ | ||
146 | static __inline struct type * \ | ||
147 | name##_SPLAY_MIN_MAX(struct name *head, int val) \ | ||
148 | { \ | ||
149 | name##_SPLAY_MINMAX(head, val); \ | ||
150 | return (SPLAY_ROOT(head)); \ | ||
151 | } | ||
152 | |||
153 | /* Main splay operation. | ||
154 | * Moves node close to the key of elm to top | ||
155 | */ | ||
156 | #define SPLAY_GENERATE(name, type, field, cmp) \ | ||
157 | struct type * \ | ||
118 | name##_SPLAY_INSERT(struct name *head, struct type *elm) \ | 158 | name##_SPLAY_INSERT(struct name *head, struct type *elm) \ |
119 | { \ | 159 | { \ |
120 | if (SPLAY_EMPTY(head)) { \ | 160 | if (SPLAY_EMPTY(head)) { \ |
@@ -132,17 +172,18 @@ name##_SPLAY_INSERT(struct name *head, struct type *elm) \ | |||
132 | SPLAY_LEFT(elm, field) = (head)->sph_root; \ | 172 | SPLAY_LEFT(elm, field) = (head)->sph_root; \ |
133 | SPLAY_RIGHT((head)->sph_root, field) = NULL; \ | 173 | SPLAY_RIGHT((head)->sph_root, field) = NULL; \ |
134 | } else \ | 174 | } else \ |
135 | return; \ | 175 | return ((head)->sph_root); \ |
136 | } \ | 176 | } \ |
137 | (head)->sph_root = (elm); \ | 177 | (head)->sph_root = (elm); \ |
178 | return (NULL); \ | ||
138 | } \ | 179 | } \ |
139 | \ | 180 | \ |
140 | static __inline void \ | 181 | struct type * \ |
141 | name##_SPLAY_REMOVE(struct name *head, struct type *elm) \ | 182 | name##_SPLAY_REMOVE(struct name *head, struct type *elm) \ |
142 | { \ | 183 | { \ |
143 | struct type *__tmp; \ | 184 | struct type *__tmp; \ |
144 | if (SPLAY_EMPTY(head)) \ | 185 | if (SPLAY_EMPTY(head)) \ |
145 | return; \ | 186 | return (NULL); \ |
146 | name##_SPLAY(head, elm); \ | 187 | name##_SPLAY(head, elm); \ |
147 | if ((cmp)(elm, (head)->sph_root) == 0) { \ | 188 | if ((cmp)(elm, (head)->sph_root) == 0) { \ |
148 | if (SPLAY_LEFT((head)->sph_root, field) == NULL) { \ | 189 | if (SPLAY_LEFT((head)->sph_root, field) == NULL) { \ |
@@ -153,47 +194,13 @@ name##_SPLAY_REMOVE(struct name *head, struct type *elm) \ | |||
153 | name##_SPLAY(head, elm); \ | 194 | name##_SPLAY(head, elm); \ |
154 | SPLAY_RIGHT((head)->sph_root, field) = __tmp; \ | 195 | SPLAY_RIGHT((head)->sph_root, field) = __tmp; \ |
155 | } \ | 196 | } \ |
197 | return (elm); \ | ||
156 | } \ | 198 | } \ |
157 | } \ | ||
158 | \ | ||
159 | /* Finds the node with the same key as elm */ \ | ||
160 | static __inline struct type * \ | ||
161 | name##_SPLAY_FIND(struct name *head, struct type *elm) \ | ||
162 | { \ | ||
163 | if (SPLAY_EMPTY(head)) \ | ||
164 | return(NULL); \ | ||
165 | name##_SPLAY(head, elm); \ | ||
166 | if ((cmp)(elm, (head)->sph_root) == 0) \ | ||
167 | return (head->sph_root); \ | ||
168 | return (NULL); \ | 199 | return (NULL); \ |
169 | } \ | 200 | } \ |
170 | \ | 201 | \ |
171 | static __inline struct type * \ | 202 | void \ |
172 | name##_SPLAY_NEXT(struct name *head, struct type *elm) \ | 203 | name##_SPLAY(struct name *head, struct type *elm) \ |
173 | { \ | ||
174 | name##_SPLAY(head, elm); \ | ||
175 | if (SPLAY_RIGHT(elm, field) != NULL) { \ | ||
176 | elm = SPLAY_RIGHT(elm, field); \ | ||
177 | while (SPLAY_LEFT(elm, field) != NULL) { \ | ||
178 | elm = SPLAY_LEFT(elm, field); \ | ||
179 | } \ | ||
180 | } else \ | ||
181 | elm = NULL; \ | ||
182 | return (elm); \ | ||
183 | } \ | ||
184 | \ | ||
185 | static __inline struct type * \ | ||
186 | name##_SPLAY_MIN_MAX(struct name *head, int val) \ | ||
187 | { \ | ||
188 | name##_SPLAY_MINMAX(head, val); \ | ||
189 | return (SPLAY_ROOT(head)); \ | ||
190 | } | ||
191 | |||
192 | /* Main splay operation. | ||
193 | * Moves node close to the key of elm to top | ||
194 | */ | ||
195 | #define SPLAY_GENERATE(name, type, field, cmp) \ | ||
196 | void name##_SPLAY(struct name *head, struct type *elm) \ | ||
197 | { \ | 204 | { \ |
198 | struct type __node, *__left, *__right, *__tmp; \ | 205 | struct type __node, *__left, *__right, *__tmp; \ |
199 | int __comp; \ | 206 | int __comp; \ |
@@ -367,7 +374,7 @@ struct { \ | |||
367 | #define RB_PROTOTYPE(name, type, field, cmp) \ | 374 | #define RB_PROTOTYPE(name, type, field, cmp) \ |
368 | void name##_RB_INSERT_COLOR(struct name *, struct type *); \ | 375 | void name##_RB_INSERT_COLOR(struct name *, struct type *); \ |
369 | void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\ | 376 | void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\ |
370 | void name##_RB_REMOVE(struct name *, struct type *); \ | 377 | struct type *name##_RB_REMOVE(struct name *, struct type *); \ |
371 | struct type *name##_RB_INSERT(struct name *, struct type *); \ | 378 | struct type *name##_RB_INSERT(struct name *, struct type *); \ |
372 | struct type *name##_RB_FIND(struct name *, struct type *); \ | 379 | struct type *name##_RB_FIND(struct name *, struct type *); \ |
373 | struct type *name##_RB_NEXT(struct name *, struct type *); \ | 380 | struct type *name##_RB_NEXT(struct name *, struct type *); \ |
@@ -498,17 +505,17 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) | |||
498 | RB_COLOR(elm, field) = RB_BLACK; \ | 505 | RB_COLOR(elm, field) = RB_BLACK; \ |
499 | } \ | 506 | } \ |
500 | \ | 507 | \ |
501 | void \ | 508 | struct type * \ |
502 | name##_RB_REMOVE(struct name *head, struct type *elm) \ | 509 | name##_RB_REMOVE(struct name *head, struct type *elm) \ |
503 | { \ | 510 | { \ |
504 | struct type *child, *parent; \ | 511 | struct type *child, *parent, *old = elm; \ |
505 | int color; \ | 512 | int color; \ |
506 | if (RB_LEFT(elm, field) == NULL) \ | 513 | if (RB_LEFT(elm, field) == NULL) \ |
507 | child = RB_RIGHT(elm, field); \ | 514 | child = RB_RIGHT(elm, field); \ |
508 | else if (RB_RIGHT(elm, field) == NULL) \ | 515 | else if (RB_RIGHT(elm, field) == NULL) \ |
509 | child = RB_LEFT(elm, field); \ | 516 | child = RB_LEFT(elm, field); \ |
510 | else { \ | 517 | else { \ |
511 | struct type *old = elm, *left; \ | 518 | struct type *left; \ |
512 | elm = RB_RIGHT(elm, field); \ | 519 | elm = RB_RIGHT(elm, field); \ |
513 | while ((left = RB_LEFT(elm, field))) \ | 520 | while ((left = RB_LEFT(elm, field))) \ |
514 | elm = left; \ | 521 | elm = left; \ |
@@ -562,6 +569,7 @@ name##_RB_REMOVE(struct name *head, struct type *elm) \ | |||
562 | color: \ | 569 | color: \ |
563 | if (color == RB_BLACK) \ | 570 | if (color == RB_BLACK) \ |
564 | name##_RB_REMOVE_COLOR(head, parent, child); \ | 571 | name##_RB_REMOVE_COLOR(head, parent, child); \ |
572 | return (old); \ | ||
565 | } \ | 573 | } \ |
566 | \ | 574 | \ |
567 | /* Inserts a node into the RB tree */ \ | 575 | /* Inserts a node into the RB tree */ \ |
diff --git a/sftp-client.c b/sftp-client.c index f77596813..f6a73f379 100644 --- a/sftp-client.c +++ b/sftp-client.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include "includes.h" | 30 | #include "includes.h" |
31 | RCSID("$OpenBSD: sftp-client.c,v 1.35 2002/09/11 22:41:49 djm Exp $"); | 31 | RCSID("$OpenBSD: sftp-client.c,v 1.35 2002/09/11 22:41:49 djm Exp $"); |
32 | 32 | ||
33 | #include "openbsd-compat/fake-queue.h" | 33 | #include "openbsd-compat/sys-queue.h" |
34 | 34 | ||
35 | #include "buffer.h" | 35 | #include "buffer.h" |
36 | #include "bufaux.h" | 36 | #include "bufaux.h" |
diff --git a/ssh-agent.c b/ssh-agent.c index 312f2269d..d4c008bbf 100644 --- a/ssh-agent.c +++ b/ssh-agent.c | |||
@@ -34,7 +34,7 @@ | |||
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include "includes.h" | 36 | #include "includes.h" |
37 | #include "openbsd-compat/fake-queue.h" | 37 | #include "openbsd-compat/sys-queue.h" |
38 | RCSID("$OpenBSD: ssh-agent.c,v 1.103 2002/09/10 20:24:47 markus Exp $"); | 38 | RCSID("$OpenBSD: ssh-agent.c,v 1.103 2002/09/10 20:24:47 markus Exp $"); |
39 | 39 | ||
40 | #include <openssl/evp.h> | 40 | #include <openssl/evp.h> |
diff --git a/ssh-keyscan.c b/ssh-keyscan.c index ae7cd86fc..8c14d6d26 100644 --- a/ssh-keyscan.c +++ b/ssh-keyscan.c | |||
@@ -9,7 +9,7 @@ | |||
9 | #include "includes.h" | 9 | #include "includes.h" |
10 | RCSID("$OpenBSD: ssh-keyscan.c,v 1.40 2002/07/06 17:47:58 stevesk Exp $"); | 10 | RCSID("$OpenBSD: ssh-keyscan.c,v 1.40 2002/07/06 17:47:58 stevesk Exp $"); |
11 | 11 | ||
12 | #include "openbsd-compat/fake-queue.h" | 12 | #include "openbsd-compat/sys-queue.h" |
13 | 13 | ||
14 | #include <openssl/bn.h> | 14 | #include <openssl/bn.h> |
15 | 15 | ||