Debian Codegraph @

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

raw symbols SCIP
1 /*
2 * Copyright 2011 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 #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`!
23 #include <config.h>cxx . . $ `<file>/build/config.h`/
24 #endif
25
26 #include <errno.h>
27 #include <stdlib.h>
28 #include "rbt_common.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/generic/rbt/rbt_common.h`/
29 #include "rbt_i64.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/generic/rbt/rbt_i64.h`/
30
31 static struct rbt_nodecxx . . $ rbt_node# *rbt_i64_node_alloccxx . . $ rbt_i64_node_alloc(f8688e5b52751a64).(void)
32 {
33 struct rbt_nodecxx . . $ rbt_node# *n = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
34 #ifndef OS_WINDOWS
35 if (posix_memaligncxx . . $ posix_memalign(e974a8a87fa206f3).((void **)(void *)(&n), sizeof(void *),
36 sizeof (struct rbt_nodecxx . . $ rbt_node#) + sizeof (struct rbt_i64_nodecxx . . $ rbt_i64_node#)) != 0)
37 {
38 abortcxx . . $ abort(8df32a62017fbbf6). ();
39 }
40 #else
41 // https://msdn.microsoft.com/en-us/library/8z34s9c6.aspx
42 n = _aligned_malloc(sizeof (struct rbt_node) + sizeof (struct rbt_i64_node), sizeof(void *));
43 #endif
44 n->_chldcxx . . $ rbt_node#_chld.[0] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
45 n->_chldcxx . . $ rbt_node#_chld.[1] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
46
47 return(n);
48 }
49
50 static void rbt_i64_node_freecxx . . $ rbt_i64_node_free(ea57ab5850a9e42).(struct rbt_nodecxx . . $ rbt_node# *n)
51 {
52 if (n != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
53 {
54 #ifndef OS_WINDOWS
55 freecxx . . $ free(5d22bdacc48458e8).(rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(n));
56 #else
57 // using free for memory allocated through _aligned_malloc is illegal
58 // rbt_i64.c -> rbt_i64_node_alloc
59 // https://msdn.microsoft.com/en-us/library/8z34s9c6.aspx
60 _aligned_free(rbt_node_ptr(n));
61 #endif
62 }
63 }
64
65 rbt_tcxx . . $ rbt_t# *rbt_i64_newcxx . . $ rbt_i64_new(557e4aca7c153cb). (void)
66 {
67 return rbt_newcxx . . $ rbt_new(14dbdc406d46a6e3). (RBT_I64KEYcxx . . $ RBT_I64KEY.);
68 }
69
70 void rbt_i64_freecxx . . $ rbt_i64_free(c2e6369c3901716e). (rbt_tcxx . . $ rbt_t# *rbt)
71 {
72 rbt_freecxx . . $ rbt_free(bee5363cd6a39661).(rbt, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
73 }
74
75 void rbt_i64_free_cbcxx . . $ rbt_i64_free_cb(7bd0bad35cac1c5c). (rbt_tcxx . . $ rbt_t# *rbt, void (*callback)(rbt_i64_node_tcxx . . $ rbt_i64_node_t# *))
76 {
77 rbt_freecxx . . $ rbt_free(bee5363cd6a39661).(rbt, (void(*)(void *))callback);
78 }
79
80 /*
81 * Add new entry to the tree. If `coll' is not NULL and there is
82 * already an entry with the same key (i.e. a collision), then
83 * place the old data pointer at `*coll' and update it to the
84 * new data pointer. Otherwise, if `coll' is NULL and there is a
85 * collision, then an error is returned and no modification of
86 * the tree is made.
87 *
88 * @param rbt pointer to the tree
89 * @param key key
90 * @param data data pointer
91 * @param coll where to store the data pointer from an colliding entry
92 */
93 int rbt_i64_addcxx . . $ rbt_i64_add(6611c7b51f165bf2).(rbt_tcxx . . $ rbt_t# *rbt, int64_tcxx . . $ int64_t# key, void *data, void **coll)
94 {
95 struct rbt_nodecxx . . $ rbt_node# fake;
96 struct rbt_nodecxx . . $ rbt_node# *h[4];
97 register uint8_tcxx . . $ uint8_t# dvec;
98 register int64_tcxx . . $ int64_t# n_key, u_key;
99
100 u_key = key;
101 rbt_wlockcxx . . $ rbt_wlock(5b7afdec655f93de).(rbt);
102
103 /*
104 * Fake node
105 */
106 fake._chldcxx . . $ rbt_node#_chld.[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
107 fake._chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!] = rbt->rootcxx . . $ rbt#root.;
108 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(&fake, RBT_NODE_CBcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:69:9`!);
109
110 /*
111 * Prepare node history stack & direction history vector
112 */
113 h[3] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
114 h[2] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
115 h[1] = &fake;
116 h[0] = rbt->rootcxx . . $ rbt#root.;
117 dvec = RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!;
118
119 for (;;) {
120 if (rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(h[0]) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
121 /*
122 * Allocate new node aligned to sizeof(void *) bytes.
123 * On most systems, malloc already returns aligned
124 * memory but we want to ensure that its aligned using
125 * posix_memalign(3).
126 */
127 h[0] = rbt_i64_node_alloccxx . . $ rbt_i64_node_alloc(f8688e5b52751a64). ();
128
129 rbt_i64_nodecxx . . $ rbt_i64_node(8d5ee7cd741215a0).(h[0])->keycxx . . $ rbt_i64_node#key. = key;
130 rbt_i64_nodecxx . . $ rbt_i64_node(8d5ee7cd741215a0).(h[0])->datacxx . . $ rbt_i64_node#data. = data;
131
132 /*
133 * Set the new node as the child of the last node we've
134 * visited. The last direction is the lowest bit of the
135 * direction history vector.
136 */
137 rbt_node_setptrcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:81:9`!(rbt_node_ptr(h[1])->_chld[dvec & 1], h[0]);
138 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(h[0], RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`!);
139
140 /*
141 * Since we are inserting a new red node, we need to fix
142 * a red violation if the parent of the new node is red.
143 */
144 if (rbt_node_getcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:94:9`!(h[1]) == RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`!) {
145 rbt_redfixcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:112:9`!(h, dvec, rbt_node_ptr(h[3])->_chld[(dvec >> 2) & 1]);
146 }
147
148 /*
149 * Update root node and color it black
150 */
151 rbt->rootcxx . . $ rbt#root. = fake._chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!];
152 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(rbt->root, RBT_NODE_CBcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:69:9`!);
153
154 /*
155 * Update node counter
156 */
157 ++(rbt->sizecxx . . $ rbt#size.);
158
159 break;
160 } else if (rbt_node_getcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:94:9`!(rbt_node_ptr(h[0])->_chld[0]) == RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`! &&
161 rbt_node_getcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:94:9`!(rbt_node_ptr(h[0])->_chld[1]) == RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`!)
162 {
163 /*
164 * Color switch
165 */
166 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(h[0], RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`!);
167 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(rbt_node_ptr(h[0])->_chld[0], RBT_NODE_CBcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:69:9`!);
168 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(rbt_node_ptr(h[0])->_chld[1], RBT_NODE_CBcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:69:9`!);
169
170 /*
171 * Fix red violation
172 */
173 if (rbt_node_getcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:94:9`!(h[1]) == RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`!) {
174 rbt_redfixcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:112:9`!(h, dvec, rbt_node_ptr(h[3])->_chld[(dvec >> 2) & 1]);
175 }
176 } else if (rbt_node_getcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:94:9`!(h[0]) == RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`! &&
177 rbt_node_getcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:94:9`!(h[1]) == RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`!)
178 {
179 /*
180 * Fix red violation
181 */
182 rbt_redfixcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:112:9`!(h, dvec, rbt_node_ptr(h[3])->_chld[(dvec >> 2)&1]);
183 }
184
185 n_key = rbt_i64_nodecxx . . $ rbt_i64_node(8d5ee7cd741215a0).(h[0])->keycxx . . $ rbt_i64_node#key.;
186
187 if (u_key < n_key) {
188 rbt_hpush4cxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:97:9`!(h, rbt_node_ptr(h[0])->_chld[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!]);
189 dvec = (dvec << 1) | RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!;
190 } else if (u_key > n_key) {
191 rbt_hpush4cxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:97:9`!(h, rbt_node_ptr(h[0])->_chld[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!]);
192 dvec = (dvec << 1) | RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!;
193 } else {
194 int r;
195
196 if (coll != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
197 *coll = rbt_i64_nodecxx . . $ rbt_i64_node(8d5ee7cd741215a0).(h[0])->datacxx . . $ rbt_i64_node#data.;
198 rbt_i64_nodecxx . . $ rbt_i64_node(8d5ee7cd741215a0).(h[0])->datacxx . . $ rbt_i64_node#data. = data;
199 r = 0;
200 } else
201 r = 1;
202
203 /*
204 * Update root node and color it black
205 */
206 rbt->rootcxx . . $ rbt#root. = fake._chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!];
207 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(rbt->root, RBT_NODE_CBcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:69:9`!);
208
209 rbt_wunlockcxx . . $ rbt_wunlock(c2e6369c3901716e).(rbt);
210 return (r);
211 }
212 }
213
214 rbt_wunlockcxx . . $ rbt_wunlock(c2e6369c3901716e).(rbt);
215 return (0);
216 }
217
218 void *rbt_i64_repcxx . . $ rbt_i64_rep(7391c618a3eff694).(rbt_tcxx . . $ rbt_t# *rbt, int64_tcxx . . $ int64_t# key, void *data)
219 {
220 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
221 }
222
223 int rbt_i64_delcxx . . $ rbt_i64_del(ad6c390963f26e29).(rbt_tcxx . . $ rbt_t# *rbt, int64_tcxx . . $ int64_t# key, void **n)
224 {
225 struct rbt_nodecxx . . $ rbt_node# fake, *save;
226 struct rbt_nodecxx . . $ rbt_node# *h[4];
227 register uint8_tcxx . . $ uint8_t# dvec;
228 register int64_tcxx . . $ int64_t# n_key, u_key;
229
230 save = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
231 u_key = key;
232
233 rbt_wlockcxx . . $ rbt_wlock(5b7afdec655f93de).(rbt);
234
235 if (rbt->sizecxx . . $ rbt#size. == 0) {
236 rbt_wunlockcxx . . $ rbt_wunlock(c2e6369c3901716e).(rbt);
237 return (1);
238 }
239
240 if (rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt->rootcxx . . $ rbt#root.) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
241 return -1;
242 }
243
244 /*
245 * Fake node
246 */
247 fake._chldcxx . . $ rbt_node#_chld.[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
248 fake._chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!] = rbt->rootcxx . . $ rbt#root.;
249 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(&fake, RBT_NODE_CBcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:69:9`!);
250
251 /*
252 * Prepare node history stack & direction history vector
253 */
254 h[2] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
255 h[1] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
256 h[0] = &fake;
257 dvec = RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!;
258
259 for (;;) {
260 if (rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(h[0])->_chldcxx . . $ rbt_node#_chld.[dvec & 1]) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
261 break;
262
263 rbt_hpush4cxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:97:9`!(h, rbt_node_ptr(h[0])->_chld[dvec & 1]);
264 n_key = rbt_i64_nodecxx . . $ rbt_i64_node(8d5ee7cd741215a0).(h[0])->keycxx . . $ rbt_i64_node#key.;
265
266 if (u_key < n_key) {
267 dvec = (dvec << 1) | RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!;
268 } else if (u_key > n_key) {
269 dvec = (dvec << 1) | RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!;
270 } else {
271 save = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(h[0]);
272 dvec = (dvec << 1) | RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!;
273 }
274
275 if (rbt_node_getcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:94:9`!(h[0]) == RBT_NODE_CBcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:69:9`! &&
276 rbt_node_getcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:94:9`!(rbt_node_ptr(h[0])->_chld[dvec & 1]) == RBT_NODE_CBcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:69:9`!)
277 {
278 if (rbt_node_getcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:94:9`!(rbt_node_ptr(h[0])->_chld[!(dvec & 1)]) == RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`!) {
279 switch(dvec & 1) {
280 case RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!:
281 rbt_node_setptrcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:81:9`!(rbt_node_ptr(h[1])->_chld[(dvec >> 1) & 1],
282 rbt_node_rotate_R(h[0]));
283 break;
284 case RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!:
285 rbt_node_setptrcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:81:9`!(rbt_node_ptr(h[1])->_chld[(dvec >> 1) & 1],
286 rbt_node_rotate_L(h[0]));
287 break;
288 }
289
290 h[1] = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(h[1])->_chldcxx . . $ rbt_node#_chld.[(dvec >> 1) & 1];
291 } else {
292 register struct rbt_nodecxx . . $ rbt_node# *s;
293
294 s = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(h[1])->_chldcxx . . $ rbt_node#_chld.[!((dvec >> 1) & 1)]);
295
296 if (s != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
297 if (rbt_node_getcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:94:9`!(s->_chld[0]) == RBT_NODE_CBcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:69:9`! &&
298 rbt_node_getcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:94:9`!(s->_chld[1]) == RBT_NODE_CBcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:69:9`!)
299 {
300 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(h[0], RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`!);
301 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(h[1], RBT_NODE_CBcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:69:9`!);
302 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(s, RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`!);
303 } else {
304 register uint8_tcxx . . $ uint8_t# d = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(h[2])->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!]) == rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(h[1]);
305
306 if (rbt_node_getcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:94:9`!(s->_chld[(dvec >> 1) & 1]) == RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`!) {
307 switch((dvec >> 1) & 1) {
308 case RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!:
309 rbt_node_setptrcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:81:9`!(rbt_node_ptr(h[2])->_chld[d],
310 rbt_node_rotate_RL(h[1]));
311 break;
312 case RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!:
313 rbt_node_setptrcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:81:9`!(rbt_node_ptr(h[2])->_chld[d],
314 rbt_node_rotate_LR(h[1]));
315 break;
316 }
317 } else if (rbt_node_getcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:94:9`!(s->_chld[!((dvec >> 1) & 1)]) == RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`!) {
318 switch((dvec >> 1) & 1) {
319 case RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!:
320 rbt_node_setptrcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:81:9`!(rbt_node_ptr(h[2])->_chld[d],
321 rbt_node_rotate_R(h[1]));
322 break;
323 case RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!:
324 rbt_node_setptrcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:81:9`!(rbt_node_ptr(h[2])->_chld[d],
325 rbt_node_rotate_L(h[1]));
326 break;
327 }
328 }
329
330 s = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(h[2])->_chldcxx . . $ rbt_node#_chld.[d]);
331
332 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(h[0], RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`!);
333 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(s, RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`!);
334 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(s->_chld[0], RBT_NODE_CBcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:69:9`!);
335 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(s->_chld[1], RBT_NODE_CBcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:69:9`!);
336 }
337 }
338 }
339 }
340 }
341
342 if (save != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
343 h[0] = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(h[0]);
344 /*
345 * The node color of the node that will be delete is always
346 * red in case the node is not the root node.
347 */
348 if (rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(fake._chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!]) != h[0] && rbt_node_getcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:94:9`!(h[0]) != RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`!) {
349 return -1;
350 }
351 if (n != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
352 *n = rbt_i64_nodecxx . . $ rbt_i64_node(8d5ee7cd741215a0).(save)->datacxx . . $ rbt_i64_node#data.;
353
354 rbt_i64_nodecxx . . $ rbt_i64_node(8d5ee7cd741215a0).(save)->datacxx . . $ rbt_i64_node#data. = rbt_i64_nodecxx . . $ rbt_i64_node(8d5ee7cd741215a0).(h[0])->datacxx . . $ rbt_i64_node#data.;
355 rbt_i64_nodecxx . . $ rbt_i64_node(8d5ee7cd741215a0).(save)->keycxx . . $ rbt_i64_node#key. = rbt_i64_nodecxx . . $ rbt_i64_node(8d5ee7cd741215a0).(h[0])->keycxx . . $ rbt_i64_node#key.;
356
357 dvec = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(h[1])->_chldcxx . . $ rbt_node#_chld.[1]) == h[0];
358
359 if (rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(h[0]->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!]) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
360 rbt_node_setptrcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:81:9`!(rbt_node_ptr(h[1])->_chld[dvec], h[0]->_chld[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!]);
361 } else {
362 rbt_node_setptrcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:81:9`!(rbt_node_ptr(h[1])->_chld[dvec], h[0]->_chld[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!]);
363 }
364
365 /*
366 * Free memory used by the deleted node and decrement
367 * the node counter.
368 */
369 rbt_i64_node_freecxx . . $ rbt_i64_node_free(ea57ab5850a9e42).(h[0]);
370 --(rbt->sizecxx . . $ rbt#size.);
371 }
372
373 /*
374 * Update root node and color it black and unlock the tree.
375 */
376 rbt->rootcxx . . $ rbt#root. = fake._chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!];
377 rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(rbt->root, RBT_NODE_CBcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:69:9`!);
378 rbt_wunlockcxx . . $ rbt_wunlock(c2e6369c3901716e).(rbt);
379
380 return (save == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ? 1 : 0);
381 }
382
383 int rbt_i64_getcxx . . $ rbt_i64_get(ad6c390963f26e29).(rbt_tcxx . . $ rbt_t# *rbt, int64_tcxx . . $ int64_t# key, void **data)
384 {
385 int r;
386 register struct rbt_nodecxx . . $ rbt_node# *n;
387 register int64_tcxx . . $ int64_t# u_key, n_key;
388
389 u_key = key;
390 r = -1;
391 rbt_rlockcxx . . $ rbt_rlock(5b7afdec655f93de).(rbt);
392 n = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(rbt->rootcxx . . $ rbt#root.);
393
394 while (n != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
395 n_key = rbt_i64_nodecxx . . $ rbt_i64_node(8d5ee7cd741215a0).(n)->keycxx . . $ rbt_i64_node#key.;
396
397 if (u_key < n_key)
398 n = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(n->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`!]);
399 else if (u_key > n_key)
400 n = rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(n->_chldcxx . . $ rbt_node#_chld.[RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`!]);
401 else {
402 r = 0;
403 *data = rbt_i64_nodecxx . . $ rbt_i64_node(8d5ee7cd741215a0).(n)->datacxx . . $ rbt_i64_node#data.;
404 break;
405 }
406 }
407
408 rbt_runlockcxx . . $ rbt_runlock(c2e6369c3901716e).(rbt);
409 return (r);
410 }
411
412 int rbt_i64_walk_preordercxx . . $ rbt_i64_walk_preorder(81e48b6a90c45ffc).(rbt_tcxx . . $ rbt_t# *rbt, int (*callback)(rbt_i64_node_tcxx . . $ rbt_i64_node_t# *), rbt_walk_tcxx . . $ rbt_walk_t# flags)
413 {
414 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = ENOSYScxx . . $ `<external>/17922322188510340118/errno.h:18:9`!;
415 return (-1);
416 }
417
418 int rbt_i64_walk_inordercxx . . $ rbt_i64_walk_inorder(81e48b6a90c45ffc).(rbt_tcxx . . $ rbt_t# *rbt, int (*callback)(rbt_i64_node_tcxx . . $ rbt_i64_node_t# *), rbt_walk_tcxx . . $ rbt_walk_t# flags)
419 {
420 return rbt_walk_inordercxx . . $ rbt_walk_inorder(c23f1c7969ddfc49).(rbt, (int(*)(void *))callback, flags);
421 }
422
423 int rbt_i64_walk_postordercxx . . $ rbt_i64_walk_postorder(81e48b6a90c45ffc).(rbt_tcxx . . $ rbt_t# *rbt, int (*callback)(rbt_i64_node_tcxx . . $ rbt_i64_node_t# *), rbt_walk_tcxx . . $ rbt_walk_t# flags)
424 {
425 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = ENOSYScxx . . $ `<external>/17922322188510340118/errno.h:18:9`!;
426 return (-1);
427 }
428
429 int rbt_i64_walk_levelordercxx . . $ rbt_i64_walk_levelorder(81e48b6a90c45ffc).(rbt_tcxx . . $ rbt_t# *rbt, int (*callback)(rbt_i64_node_tcxx . . $ rbt_i64_node_t# *), rbt_walk_tcxx . . $ rbt_walk_t# flags)
430 {
431 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = ENOSYScxx . . $ `<external>/17922322188510340118/errno.h:18:9`!;
432 return (-1);
433 }
434
435 int rbt_i64_walkcxx . . $ rbt_i64_walk(1c587b70dd44ce59).(rbt_tcxx . . $ rbt_t# *rbt, rbt_walk_tcxx . . $ rbt_walk_t# type, int (*callback)(rbt_i64_node_tcxx . . $ rbt_i64_node_t# *))
436 {
437 if (rbt == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || callback == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
438 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
439 return -1;
440 }
441
442 switch (type & RBT_WALK_TYPEMASKcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:57:9`!) {
443 case RBT_WALK_PREORDERcxx . . $ RBT_WALK_PREORDER.: return rbt_i64_walk_preordercxx . . $ rbt_i64_walk_preorder(81e48b6a90c45ffc).(rbt, callback, type);
444 case RBT_WALK_INORDERcxx . . $ RBT_WALK_INORDER.: return rbt_i64_walk_inordercxx . . $ rbt_i64_walk_inorder(81e48b6a90c45ffc).(rbt, callback, type);
445 case RBT_WALK_POSTORDERcxx . . $ RBT_WALK_POSTORDER.: return rbt_i64_walk_postordercxx . . $ rbt_i64_walk_postorder(81e48b6a90c45ffc).(rbt, callback, type);
446 case RBT_WALK_LEVELORDERcxx . . $ RBT_WALK_LEVELORDER.: return rbt_i64_walk_levelordercxx . . $ rbt_i64_walk_levelorder(81e48b6a90c45ffc).(rbt, callback, type);
447 }
448
449 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!;
450 return (-1);
451 }
452
453 size_t rbt_i64_sizecxx . . $ rbt_i64_size(6ae908cc234686bf).(rbt_tcxx . . $ rbt_t# *rbt)
454 {
455 return rbt_sizecxx . . $ rbt_size(6ae908cc234686bf).(rbt);
456 }