Debian Codegraph @

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

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 #ifndef RBT_COMMON_H
23 #define RBT_COMMON_Hcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:23:9`!
24
25 #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`!
26 #include <config.h>cxx . . $ `<file>/build/config.h`/
27 #endif
28
29 #include <stdint.h>
30 #include <stdbool.h>
31
32 #if defined(RBT_IMPLICIT_LOCKINGcxx . . $ `<built-in>:423:9`!)
33 # include <pthread.h>
34 #endif
35
36 #ifndef HAVE_POSIX_MEMALIGNcxx . . $ `build/config.h:57:9`!
37 # ifdef HAVE_MEMALIGN
38 int posix_memalign(void **memptr, size_t alignment, size_t size);
39 # endif /* HAVE_MEMALIGN */
40 #endif /* HAVE_POSIX_MEMALIGN */
41
42 typedef enumcxx . . $ $anonymous_type_8bc8888c4d6864ef_0# {
43 RBT_GENKEYcxx . . $ RBT_GENKEY.,
44 RBT_STRKEYcxx . . $ RBT_STRKEY.,
45 RBT_I32KEYcxx . . $ RBT_I32KEY.,
46 RBT_I64KEYcxx . . $ RBT_I64KEY.
47 } rbt_type_tcxx . . $ rbt_type_t#;
48
49 typedef enumcxx . . $ $anonymous_type_8bc8888c4d6864ef_1# {
50 RBT_WALK_PREORDERcxx . . $ RBT_WALK_PREORDER. = 0x01,
51 RBT_WALK_INORDERcxx . . $ RBT_WALK_INORDER. = 0x02,
52 RBT_WALK_POSTORDERcxx . . $ RBT_WALK_POSTORDER. = 0x03,
53 RBT_WALK_LEVELORDERcxx . . $ RBT_WALK_LEVELORDER. = 0x04,
54 RBT_WALK_RAWNODEcxx . . $ RBT_WALK_RAWNODE. = 0x10
55 } rbt_walk_tcxx . . $ rbt_walk_t#;
56
57 #define RBT_WALK_TYPEMASKcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:57:9`! 0x0f
58 #define RBT_WALK_FLAGMASKcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:58:9`! 0xf0
59
60 /**
61 * Generic node structure
62 * Lowest bit of _chld[0] holds the color bit
63 */
64 struct rbt_nodecxx . . $ rbt_node# {
65 struct rbt_nodecxx . . $ rbt_node# *_chldcxx . . $ rbt_node#_chld.[2];
66 uint8_tcxx . . $ uint8_t# _nodecxx . . $ rbt_node#_node.[];
67 };
68
69 #define RBT_NODE_CBcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:69:9`! 0
70 #define RBT_NODE_CRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:70:9`! 1
71 #define RBT_NODE_SLcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:71:9`! 0
72 #define RBT_NODE_SRcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:72:9`! 1
73
74 __attribute__((pure)) static inline struct rbt_nodecxx . . $ rbt_node# *rbt_node_ptrcxx . . $ rbt_node_ptr(a7124440667b6d30).(const struct rbt_nodecxx . . $ rbt_node# *nodep)
75 {
76 register uintptr_tcxx . . $ uintptr_t# nodep_uint = (uintptr_tcxx . . $ uintptr_t#)(nodep);
77 nodep_uint &= UINTPTR_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:177:11`! << 1;
78 return (struct rbt_nodecxx . . $ rbt_node# *)(nodep_uint);
79 }
80
81 #define rbt_node_setptrcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:81:9`!(dst,src) (dst) = (struct rbt_node *)((uintptr_t)rbt_node_ptr(src)|((uintptr_t)(dst)&1))
82
83 #define rbt_node_setcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:83:9`!(np, cb) \
84 do { \
85 register struct rbt_node *__n = rbt_node_ptr(np); \
86 register uint8_t __c = (cb) & 1; \
87 \
88 if (__n != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) { \
89 if (__c) __n->_chld[0] = (struct rbt_node *)((uintptr_t)(__n->_chld[0]) | 1); \
90 else __n->_chld[0] = rbt_node_ptr(__n->_chld[0]); \
91 } \
92 } while(0)
93 #define rbt_node_getcolor_rawcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:93:9`!(cp) ((uintptr_t)(cp) & 1)
94 #define rbt_node_getcolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:94:9`!(np) (rbt_node_ptr(np) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ? RBT_NODE_CBcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:69:9`! : rbt_node_getcolor_rawcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:93:9`!(rbt_node_ptr(np)->_chld[0]))
95 #define rbt_node_cpycolorcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:95:9`!(dn, sn) rbt_node_setcolor((dn), rbt_node_getcolor(sn))
96
97 #define rbt_hpush4cxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:97:9`!(__a, __p) \
98 do { \
99 __a[3] = __a[2]; \
100 __a[2] = __a[1]; \
101 __a[1] = __a[0]; \
102 __a[0] = __p; \
103 } while(0)
104
105 #define rbt_hpush3cxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:105:9`!(__a, __p) \
106 do { \
107 __a[2] = __a[1]; \
108 __a[1] = __a[0]; \
109 __a[0] = __p; \
110 } while(0)
111
112 #define rbt_redfixcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:112:9`!(__h, __d, v) \
113 do { \
114 if (((__d) & 3) < 2) { \
115 if (((__d) & 3) == 0) { \
116 rbt_node_setptrcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:81:9`!(v, rbt_node_rotate_R(__h[2])); \
117 } else { \
118 rbt_node_setptrcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:81:9`!(v, rbt_node_rotate_RL(__h[2])); \
119 } \
120 } else { \
121 if (((__d) & 3) == 2) { \
122 rbt_node_setptrcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:81:9`!(v, rbt_node_rotate_LR(__h[2])); \
123 } else { \
124 rbt_node_setptrcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:81:9`!(v, rbt_node_rotate_L(__h[2])); \
125 } \
126 } \
127 } while(0)
128
129 struct rbtcxx . . $ rbt# {
130 struct rbt_nodecxx . . $ rbt_node# *rootcxx . . $ rbt#root.;
131 size_t sizecxx . . $ rbt#size.;
132 rbt_type_tcxx . . $ rbt_type_t# typecxx . . $ rbt#type.;
133 #if defined(RBT_IMPLICIT_LOCKINGcxx . . $ `<built-in>:423:9`!)
134 pthread_rwlock_tcxx . . $ pthread_rwlock_t# lockcxx . . $ rbt#lock.;
135 #endif
136 };
137
138 typedef struct rbtcxx . . $ rbt# rbt_tcxx . . $ rbt_t#;
139
140 /**
141 * Create new tree
142 * @param type type of key that will be used in the tree
143 */
144 rbt_tcxx . . $ rbt_t# *rbt_newcxx . . $ rbt_new(14dbdc406d46a6e3).(rbt_type_tcxx . . $ rbt_type_t# type);
145
146 /**
147 * Free resources used to hold information about the tree. This
148 * function does not free memory pointed to by the data pointer
149 * in a node.
150 * @param rbt tree pointer
151 */
152 void rbt_freecxx . . $ rbt_free(bee5363cd6a39661).(rbt_tcxx . . $ rbt_t# *rbt, void (*callback)(void *));
153 void rbt_free2cxx . . $ rbt_free2(d2d9e6d8aa181e03).(rbt_tcxx . . $ rbt_t# *rbt, void (*callback)(void *, void *), void *user);
154
155 /**
156 * Lock a tree for reading
157 * @param rbt tree pointer
158 */
159 int rbt_rlockcxx . . $ rbt_rlock(5b7afdec655f93de).(rbt_tcxx . . $ rbt_t# *rbt);
160
161 /**
162 * Unlock a tree that was locked for reading before
163 * @param rbt tree pointer
164 */
165 void rbt_runlockcxx . . $ rbt_runlock(c2e6369c3901716e).(rbt_tcxx . . $ rbt_t# *rbt);
166
167 /**
168 * Lock a tree for writing (i.e. adding, deleting, replacing)
169 * @param rbt tree pointer
170 */
171 int rbt_wlockcxx . . $ rbt_wlock(5b7afdec655f93de).(rbt_tcxx . . $ rbt_t# *rbt);
172
173 /**
174 * Unlock a tree that was locked for writing before
175 * @param rbt tree pointer
176 */
177 void rbt_wunlockcxx . . $ rbt_wunlock(c2e6369c3901716e).(rbt_tcxx . . $ rbt_t# *rbt);
178
179 struct rbt_nodecxx . . $ rbt_node# *rbt_node_rotate_Lcxx . . $ rbt_node_rotate_L(98565e986a541fa4).(struct rbt_nodecxx . . $ rbt_node# *);
180 struct rbt_nodecxx . . $ rbt_node# *rbt_node_rotate_Rcxx . . $ rbt_node_rotate_R(98565e986a541fa4).(struct rbt_nodecxx . . $ rbt_node# *);
181 struct rbt_nodecxx . . $ rbt_node# *rbt_node_rotate_LRcxx . . $ rbt_node_rotate_LR(98565e986a541fa4).(struct rbt_nodecxx . . $ rbt_node# *);
182 struct rbt_nodecxx . . $ rbt_node# *rbt_node_rotate_RLcxx . . $ rbt_node_rotate_RL(98565e986a541fa4).(struct rbt_nodecxx . . $ rbt_node# *);
183
184 size_t rbt_sizecxx . . $ rbt_size(6ae908cc234686bf).(rbt_tcxx . . $ rbt_t# *rbt);
185
186 #define rbt_walk_pushcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:186:9`!(n) stack[depth++] = (n)
187 #define rbt_walk_popcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:187:9`!() stack[--depth]
188 #define rbt_walk_topcxx . . $ `src/OVAL/probes/SEAP/generic/rbt/rbt_common.h:188:9`!() stack[depth-1]
189
190 int rbt_walk_preordercxx . . $ rbt_walk_preorder(c23f1c7969ddfc49).(rbt_tcxx . . $ rbt_t# *rbt, int (*callback)(void *), rbt_walk_tcxx . . $ rbt_walk_t# flags);
191 int rbt_walk_inordercxx . . $ rbt_walk_inorder(c23f1c7969ddfc49).(rbt_tcxx . . $ rbt_t# *rbt, int (*callback)(void *), rbt_walk_tcxx . . $ rbt_walk_t# flags);
192 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);
193 int rbt_walk_postordercxx . . $ rbt_walk_postorder(c23f1c7969ddfc49).(rbt_tcxx . . $ rbt_t# *rbt, int (*callback)(void *), rbt_walk_tcxx . . $ rbt_walk_t# flags);
194
195 #endif /* RBT_COMMON_H */