Debian Codegraph @

src/OVAL/probes/SEAP/generic/rbt/rbt_common.c

raw symbols SCIP
1 /*
2 * Copyright 2010 Red Hat Inc., Durham, North Carolina.
3 * All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * Authors:
20 * "Daniel Kopecek" <[email protected]>
21 */
22
23 #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`!
24 #include <config.h>cxx . . $ `<file>/build/config.h`/
25 #endif
26
27 #include <stdint.h>
28 #include <stdlib.h>
29 #include <errno.h>
30
31 #include "rbt_common.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/generic/rbt/rbt_common.h`/
32
33 rbt_tcxx . . $ rbt_t# *rbt_newcxx . . $ rbt_new(14dbdc406d46a6e3).(rbt_type_tcxx . . $ rbt_type_t# type)
34 {
35 rbt_tcxx . . $ rbt_t# *rbt;
36
37 switch (type) {
38 case RBT_GENKEYcxx . . $ RBT_GENKEY.:
39 case RBT_STRKEYcxx . . $ RBT_STRKEY.:
40 case RBT_I32KEYcxx . . $ RBT_I32KEY.:
41 case RBT_I64KEYcxx . . $ RBT_I64KEY.:
42 break;
43 default:
44 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
45 return (NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!);
46 }
47
48 rbt = malloccxx . . $ malloc(bfcfa4d6b7f7ef64). (sizeof (rbt_tcxx . . $ rbt_t#));
49 if (rbt == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!)
50 return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
51
52 rbt->typecxx . . $ rbt#type. = type;
53 rbt->rootcxx . . $ rbt#root. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
54 rbt->sizecxx . . $ rbt#size. = 0;
55
56 #if defined(RBT_IMPLICIT_LOCKINGcxx . . $ `<built-in>:423:9`!)
57 pthread_rwlock_initcxx . . $ pthread_rwlock_init(fc6013e2b28f9555). (&rbt->lockcxx . . $ rbt#lock., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!);
58 #endif
59 return (rbt);
60 }
61
62 /**
63 * Free resources used to hold information about the tree. This
64 * function does not free memory pointed to by the data pointer
65 * in a node - you have to free this memory by walking thru the
66 * tree or use the callback version of rbt_free for a specific
67 * tree type.
68 * @param rbt tree pointer
69 */
70 void rbt_freecxx . . $ rbt_free(bee5363cd6a39661).(rbt_tcxx . . $ rbt_t# *rbt, void (*callback)(void *))
71 {
72 struct rbt_nodecxx . . $ rbt_node# *stack[48], *n;
73 register uint8_tcxx . . $ uint8_t# depth;
74
75 rbt_wlockcxx . . $ rbt_wlock(5b7afdec655f93de).(rbt);
76
77 depth = 0;
78 n = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt->rootcxx . . $ rbt#root.);
79
80 if (n != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) {
81 rbt_walk_pushcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:186:9`!(n);
82
83 while(depth > 0) {
84 n = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt_walk_topcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:188:9`!()->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!]);
85
86 if (n != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!)
87 rbt_walk_pushcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:186:9`!(n);
88 else {
89 found_in:
90 if (callback != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!)
91 callback((void *)&(rbt_walk_topcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:188:9`!()->_nodecxx . . $ rbt_node#_node.));
92
93 n = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt_walk_topcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:188:9`!()->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!]);
94 #ifndef OS_WINDOWS
95 freecxx . . $ free(5d22bdacc48458e8).(rbt_walk_topcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:188:9`!());
96 #else
97 // using free for memory allocated through _aligned_malloc is illegal
98 // rbt_str.c -> rbt_str_node_alloc
99 // https://msdn.microsoft.com/en-us/library/8z34s9c6.aspx
100 _aligned_free(rbt_walk_top());
101 #endif
102
103 if (n != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!)
104 rbt_walk_topcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:188:9`!() = n;
105 else {
106 if (--depth > 0)
107 goto found_in;
108 else
109 break;
110 }
111 }
112 }
113 }
114 rbt_wunlockcxx . . $ rbt_wunlock(c2e6369c3901716e).(rbt);
115
116 rbt->rootcxx . . $ rbt#root. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
117 rbt->sizecxx . . $ rbt#size. = 0;
118 rbt->typecxx . . $ rbt#type. = -1;
119
120 #if defined(RBT_IMPLICIT_LOCKINGcxx . . $ `<built-in>:423:9`!)
121 pthread_rwlock_destroycxx . . $ pthread_rwlock_destroy(e530de6d038c3578). (&rbt->lockcxx . . $ rbt#lock.);
122 #endif
123 freecxx . . $ free(5d22bdacc48458e8). (rbt);
124 return;
125 }
126
127 void rbt_free2cxx . . $ rbt_free2(d2d9e6d8aa181e03).(rbt_tcxx . . $ rbt_t# *rbt, void (*callback)(void *, void *), void *user)
128 {
129 struct rbt_nodecxx . . $ rbt_node# *stack[48], *n;
130 register uint8_tcxx . . $ uint8_t# depth;
131
132 rbt_wlockcxx . . $ rbt_wlock(5b7afdec655f93de).(rbt);
133
134 depth = 0;
135 n = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt->rootcxx . . $ rbt#root.);
136
137 if (n != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) {
138 rbt_walk_pushcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:186:9`!(n);
139
140 while(depth > 0) {
141 n = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt_walk_topcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:188:9`!()->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!]);
142
143 if (n != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!)
144 rbt_walk_pushcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:186:9`!(n);
145 else {
146 found_in:
147 if (callback != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!)
148 callback((void *)&(rbt_walk_topcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:188:9`!()->_nodecxx . . $ rbt_node#_node.), user);
149
150 n = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt_walk_topcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:188:9`!()->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!]);
151 #ifndef OS_WINDOWS
152 freecxx . . $ free(5d22bdacc48458e8).(rbt_walk_topcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:188:9`!());
153 #else
154 // using free for memory allocated through _aligned_malloc is illegal
155 // rbt_str.c -> rbt_str_node_alloc
156 // https://msdn.microsoft.com/en-us/library/8z34s9c6.aspx
157 _aligned_free(rbt_walk_top());
158 #endif
159
160 if (n != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!)
161 rbt_walk_topcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:188:9`!() = n;
162 else {
163 if (--depth > 0)
164 goto found_in;
165 else
166 break;
167 }
168 }
169 }
170 }
171 rbt_wunlockcxx . . $ rbt_wunlock(c2e6369c3901716e).(rbt);
172
173 rbt->rootcxx . . $ rbt#root. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
174 rbt->sizecxx . . $ rbt#size. = 0;
175 rbt->typecxx . . $ rbt#type. = -1;
176
177 #if defined(RBT_IMPLICIT_LOCKINGcxx . . $ `<built-in>:423:9`!)
178 pthread_rwlock_destroycxx . . $ pthread_rwlock_destroy(e530de6d038c3578). (&rbt->lockcxx . . $ rbt#lock.);
179 #endif
180 freecxx . . $ free(5d22bdacc48458e8). (rbt);
181 return;
182 }
183
184 #if defined(RBT_IMPLICIT_LOCKINGcxx . . $ `<built-in>:423:9`!)
185 int rbt_rlockcxx . . $ rbt_rlock(5b7afdec655f93de).(rbt_tcxx . . $ rbt_t# *rbt)
186 {
187 if (rbt == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) {
188 return -1;
189 }
190
191 if (pthread_rwlock_rdlockcxx . . $ pthread_rwlock_rdlock(e530de6d038c3578).(&rbt->lockcxx . . $ rbt#lock.) != 0)
192 return (-1);
193 else
194 return (0);
195 }
196
197 void rbt_runlockcxx . . $ rbt_runlock(c2e6369c3901716e).(rbt_tcxx . . $ rbt_t# *rbt)
198 {
199 if (rbt == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) {
200 return;
201 }
202
203 if (pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&rbt->lockcxx . . $ rbt#lock.) != 0) {
204 /*
205 * Unlock failed - we abort() here so as
206 * not to cause a deadlock
207 */
208 abortcxx . . $ abort(8df32a62017fbbf6). ();
209 }
210
211 return;
212 }
213
214 int rbt_wlockcxx . . $ rbt_wlock(5b7afdec655f93de).(rbt_tcxx . . $ rbt_t# *rbt)
215 {
216 if (rbt == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) {
217 return -1;
218 }
219 if (pthread_rwlock_wrlockcxx . . $ pthread_rwlock_wrlock(e530de6d038c3578).(&rbt->lockcxx . . $ rbt#lock.) != 0)
220 return (-1);
221 else
222 return (0);
223 }
224
225 void rbt_wunlockcxx . . $ rbt_wunlock(c2e6369c3901716e).(rbt_tcxx . . $ rbt_t# *rbt)
226 {
227 if (rbt == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) {
228 return;
229 }
230 rbt_runlockcxx . . $ rbt_runlock(c2e6369c3901716e).(rbt);
231 return;
232 }
233 #else
234 int rbt_rlock(rbt_t *rbt) { return(0); }
235 void rbt_runlock(rbt_t *rbt) { return; }
236 int rbt_wlock(rbt_t *rbt) { return(0); }
237 void rbt_wunlock(rbt_t *rbt) { return; }
238 #endif /* RBT_IMPLICIT_LOCKING */
239
240 /*
241 * Single rotation to the left. Used for fixing a black violation.
242 *
243 * == Assumptions ==
244 * - input node is black
245 * - output node is black
246 * - child nodes of the new subtree node (the output node) are red
247 */
248 struct rbt_nodecxx . . $ rbt_node# *rbt_node_rotate_Lcxx . . $ rbt_node_rotate_L(98565e986a541fa4).(struct rbt_nodecxx . . $ rbt_node# *r)
249 {
250 register struct rbt_nodecxx . . $ rbt_node# *n, *o;
251
252 o = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(r);
253
254 /*
255 * New subtree root node `n' is the left child node of
256 * the old subtree root node `r'. This node has the
257 * color black.
258 */
259 n = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(o->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!]);
260
261 /*
262 * Now the left child has to be updated so that it
263 * points to the right child of the old left child
264 * node. The old left child node pointer is stored
265 * in `n'.
266 */
267 o->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!] = n->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!];
268 n->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!] = o;
269
270 /*
271 * Make sure that nodes have proper colors set.
272 */
273 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(n, RBT_NODE_CBcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:69:9`!);
274 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(o, RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`!);
275
276 return (struct rbt_nodecxx . . $ rbt_node# *)((uintptr_tcxx . . $ uintptr_t#)(n)|((uintptr_tcxx . . $ uintptr_t#)(r)&1));
277 }
278
279 /*
280 * Single rotation to the right. Used for fixing a black violation.
281 * No-recoloring needed here.
282 */
283 struct rbt_nodecxx . . $ rbt_node# *rbt_node_rotate_Rcxx . . $ rbt_node_rotate_R(98565e986a541fa4).(struct rbt_nodecxx . . $ rbt_node# *r)
284 {
285 register struct rbt_nodecxx . . $ rbt_node# *n, *o;
286
287 o = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(r);
288
289 /*
290 * New subtree root node `n' is the left child node of
291 * the old subtree root node `r'. This node has the
292 * color black.
293 */
294 n = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(o->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!]);
295
296 /*
297 * Now the right child has to be updated so that it
298 * points to the left child of the old right child
299 * node. The old right child node pointer is stored
300 * in `n'.
301 */
302 o->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!] = n->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!];
303 n->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!] = o;
304
305 /*
306 * Make sure that nodes have proper colors set.
307 */
308 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(n, RBT_NODE_CBcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:69:9`!);
309 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(o, RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`!);
310
311 return (struct rbt_nodecxx . . $ rbt_node# *)((uintptr_tcxx . . $ uintptr_t#)(n)|((uintptr_tcxx . . $ uintptr_t#)(r)&1));
312 }
313
314 /*
315 * Double rotation to the left and then to the right. Used for fixing a red violation.
316 */
317 struct rbt_nodecxx . . $ rbt_node# *rbt_node_rotate_LRcxx . . $ rbt_node_rotate_LR(98565e986a541fa4).(struct rbt_nodecxx . . $ rbt_node# *r)
318 {
319 register struct rbt_nodecxx . . $ rbt_node# *n, *o;
320
321 o = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(r);
322 n = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(o->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!])->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!]);
323
324 rbt_node_setptrcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:81:9`!(rbt_node_ptr(o->_chld[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!])->_chld[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!], n->_chld[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!]);
325
326 n->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!] = o->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!];
327 o->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!] = n->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!];
328 n->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!] = o;
329
330 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(n->_chld[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!], RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`!);
331 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(n->_chld[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!], RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`!);
332 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(n, RBT_NODE_CBcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:69:9`!);
333
334 return (struct rbt_nodecxx . . $ rbt_node# *)((uintptr_tcxx . . $ uintptr_t#)(n)|((uintptr_tcxx . . $ uintptr_t#)(r)&1));
335 }
336
337 /*
338 * Double rotation to the right and then to the left. Used for fixing a red violation.
339 */
340 struct rbt_nodecxx . . $ rbt_node# *rbt_node_rotate_RLcxx . . $ rbt_node_rotate_RL(98565e986a541fa4).(struct rbt_nodecxx . . $ rbt_node# *r)
341 {
342 register struct rbt_nodecxx . . $ rbt_node# *n, *o;
343
344 o = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(r);
345 n = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(o->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!])->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!]);
346
347 rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(o->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!])->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!] = n->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!];
348
349 n->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!] = o->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!];
350 rbt_node_setptrcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:81:9`!(o->_chld[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!], n->_chld[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!]);
351 n->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!] = o;
352
353 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(n->_chld[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!], RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`!);
354 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(n->_chld[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!], RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`!);
355 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(n, RBT_NODE_CBcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:69:9`!);
356
357 return (struct rbt_nodecxx . . $ rbt_node# *)((uintptr_tcxx . . $ uintptr_t#)(n)|((uintptr_tcxx . . $ uintptr_t#)(r)&1));
358 }
359
360 size_t rbt_sizecxx . . $ rbt_size(6ae908cc234686bf).(rbt_tcxx . . $ rbt_t# *rbt)
361 {
362 size_t size;
363
364 rbt_rlockcxx . . $ rbt_rlock(5b7afdec655f93de).(rbt);
365 size = rbt->sizecxx . . $ rbt#size.;
366 rbt_runlockcxx . . $ rbt_runlock(c2e6369c3901716e).(rbt);
367
368 return (size);
369 }
370
371 int rbt_walk_preordercxx . . $ rbt_walk_preorder(c23f1c7969ddfc49).(rbt_tcxx . . $ rbt_t# *rbt, int (*callback)(void *), rbt_walk_tcxx . . $ rbt_walk_t# flags)
372 {
373 return(-1);
374 }
375
376 int rbt_walk_inordercxx . . $ rbt_walk_inorder(c23f1c7969ddfc49).(rbt_tcxx . . $ rbt_t# *rbt, int (*callback)(void *), rbt_walk_tcxx . . $ rbt_walk_t# flags)
377 {
378 struct rbt_nodecxx . . $ rbt_node# *stack[48], *n;
379 register uint8_tcxx . . $ uint8_t# depth, delta;
380 register int r;
381
382 if (rbt == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) {
383 return -1;
384 }
385
386 if (flags & RBT_WALK_RAWNODEcxx . . $ RBT_WALK_RAWNODE.)
387 delta = 0;
388 else {
389 delta = sizeof(void *) * 2;
390 }
391
392 depth = 0;
393 n = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt->rootcxx . . $ rbt#root.);
394
395 if (n != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!)
396 rbt_walk_pushcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:186:9`!(n);
397 else
398 return (0);
399
400 while(depth > 0) {
401 n = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt_walk_topcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:188:9`!()->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!]);
402
403 if (n != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!)
404 rbt_walk_pushcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:186:9`!(n);
405 else {
406 found_in:
407 r = callback((void *)((uintptr_tcxx . . $ uintptr_t#)(rbt_walk_topcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:188:9`!()) + delta));
408
409 if (r != 0)
410 return (r);
411
412 n = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt_walk_topcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:188:9`!()->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!]);
413
414 if (n != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!)
415 rbt_walk_topcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:188:9`!() = n;
416 else {
417 if (--depth > 0)
418 goto found_in;
419 else
420 break;
421 }
422 }
423 }
424
425 return(0);
426 }
427
428 int rbt_walk_inorder2cxx . . $ rbt_walk_inorder2(bba4ddba429b8b1).(rbt_tcxx . . $ rbt_t# *rbt, int (*callback)(void *, void *), void *user, rbt_walk_tcxx . . $ rbt_walk_t# flags)
429 {
430 struct rbt_nodecxx . . $ rbt_node# *stack[48], *n;
431 register uint8_tcxx . . $ uint8_t# depth, delta;
432 register int r;
433
434 if (rbt == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) {
435 return -1;
436 }
437
438 if (flags & RBT_WALK_RAWNODEcxx . . $ RBT_WALK_RAWNODE.)
439 delta = 0;
440 else {
441 delta = sizeof(void *) * 2;
442 }
443
444 depth = 0;
445 n = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt->rootcxx . . $ rbt#root.);
446
447 if (n != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!)
448 rbt_walk_pushcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:186:9`!(n);
449 else
450 return (0);
451
452 while(depth > 0) {
453 n = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt_walk_topcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:188:9`!()->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!]);
454
455 if (n != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!)
456 rbt_walk_pushcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:186:9`!(n);
457 else {
458 found_in:
459 r = callback((void *)((uintptr_tcxx . . $ uintptr_t#)(rbt_walk_topcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:188:9`!()) + delta), user);
460
461 if (r != 0)
462 return (r);
463
464 n = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt_walk_topcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:188:9`!()->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!]);
465
466 if (n != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!)
467 rbt_walk_topcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:188:9`!() = n;
468 else {
469 if (--depth > 0)
470 goto found_in;
471 else
472 break;
473 }
474 }
475 }
476
477 return(0);
478 }
479
480 int rbt_walk_postordercxx . . $ rbt_walk_postorder(c23f1c7969ddfc49).(rbt_tcxx . . $ rbt_t# *rbt, int (*callback)(void *), rbt_walk_tcxx . . $ rbt_walk_t# flags)
481 {
482 return(-1);
483 }
484
485 #ifndef HAVE_POSIX_MEMALIGNcxx . . $ `build/config.h:57:9`!
486 # ifdef HAVE_MEMALIGN
487
488 /* Implementing posix_memalign using memalign */
489 int posix_memalign(void **memptr, size_t alignment, size_t size)
490 {
491 if ((alignment % sizeof(void *)) != 0)
492 {
493 return EINVAL;
494 }
495
496 *memptr = memalign(alignment, size);
497
498 /* The spec for posix_memalign requires that alignment be a power
499 of 2. Memalign checks for that case, and returns NULL on failure. */
500 if (*memptr == NULL)
501 {
502 /* posix_memalign must return an appropriate error code */
503 return EINVAL;
504 }
505 return 0;
506 }
507 # endif /* HAVE_MEMALIGN */
508 #endif /* HAVE_POSIX_MEMALIGN */