BadVPN – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /** |
2 | * @file SAvl_decl.h |
||
3 | * @author Ambroz Bizjak <ambrop7@gmail.com> |
||
4 | * |
||
5 | * @section LICENSE |
||
6 | * |
||
7 | * Redistribution and use in source and binary forms, with or without |
||
8 | * modification, are permitted provided that the following conditions are met: |
||
9 | * 1. Redistributions of source code must retain the above copyright |
||
10 | * notice, this list of conditions and the following disclaimer. |
||
11 | * 2. Redistributions in binary form must reproduce the above copyright |
||
12 | * notice, this list of conditions and the following disclaimer in the |
||
13 | * documentation and/or other materials provided with the distribution. |
||
14 | * 3. Neither the name of the author nor the |
||
15 | * names of its contributors may be used to endorse or promote products |
||
16 | * derived from this software without specific prior written permission. |
||
17 | * |
||
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
||
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||
20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||
21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
||
22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||
23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||
24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||
25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||
27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
28 | */ |
||
29 | |||
30 | #include "SAvl_header.h" |
||
31 | |||
32 | typedef SAvlEntry *SAvl__TreeLink; |
||
33 | |||
34 | #include "SAvl_tree.h" |
||
35 | #include <structure/CAvl_decl.h> |
||
36 | |||
37 | typedef struct { |
||
38 | SAvl__Tree tree; |
||
39 | } SAvl; |
||
40 | |||
41 | typedef struct { |
||
42 | SAvlEntry *child[2]; |
||
43 | SAvlEntry *parent; |
||
44 | int8_t balance; |
||
45 | #if SAVL_PARAM_FEATURE_COUNTS |
||
46 | SAvlCount count; |
||
47 | #endif |
||
48 | } SAvlNode; |
||
49 | |||
50 | static void SAvl_Init (SAvl *o); |
||
51 | static int SAvl_Insert (SAvl *o, SAvlArg arg, SAvlEntry *entry, SAvlEntry **out_existing); |
||
52 | static void SAvl_Remove (SAvl *o, SAvlArg arg, SAvlEntry *entry); |
||
53 | #if !SAVL_PARAM_FEATURE_NOKEYS |
||
54 | static SAvlEntry * SAvl_Lookup (const SAvl *o, SAvlArg arg, SAvlKey key); |
||
55 | static SAvlEntry * SAvl_LookupExact (const SAvl *o, SAvlArg arg, SAvlKey key); |
||
56 | static SAvlEntry * SAvl_GetFirstGreater (const SAvl *o, SAvlArg arg, SAvlKey key); |
||
57 | static SAvlEntry * SAvl_GetLastLesser (const SAvl *o, SAvlArg arg, SAvlKey key); |
||
58 | static SAvlEntry * SAvl_GetFirstGreaterEqual (const SAvl *o, SAvlArg arg, SAvlKey key); |
||
59 | static SAvlEntry * SAvl_GetLastLesserEqual (const SAvl *o, SAvlArg arg, SAvlKey key); |
||
60 | #endif |
||
61 | static SAvlEntry * SAvl_GetFirst (const SAvl *o, SAvlArg arg); |
||
62 | static SAvlEntry * SAvl_GetLast (const SAvl *o, SAvlArg arg); |
||
63 | static SAvlEntry * SAvl_GetNext (const SAvl *o, SAvlArg arg, SAvlEntry *entry); |
||
64 | static SAvlEntry * SAvl_GetPrev (const SAvl *o, SAvlArg arg, SAvlEntry *entry); |
||
65 | static int SAvl_IsEmpty (const SAvl *o); |
||
66 | static void SAvl_Verify (const SAvl *o, SAvlArg arg); |
||
67 | #if SAVL_PARAM_FEATURE_COUNTS |
||
68 | static SAvlCount SAvl_Count (const SAvl *o, SAvlArg arg); |
||
69 | static SAvlCount SAvl_IndexOf (const SAvl *o, SAvlArg arg, SAvlEntry *entry); |
||
70 | static SAvlEntry * SAvl_GetAt (const SAvl *o, SAvlArg arg, SAvlCount index); |
||
71 | #endif |
||
72 | |||
73 | #include "SAvl_footer.h" |