Fri, 22 Sep 2017 20:19:00 +0200
fixes possible UAF for locktocken paths, if file could not be opened
1
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
3 | * |
255
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
4 | * Copyright 2016 Olaf Wintermann. All rights reserved. |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
5 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
8 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
11 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
15 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
27 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
28 | /** |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
29 | * Doubly linked list implementation. |
1
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | * |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
31 | * @file list.h |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
32 | * @author Mike Becker |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
33 | * @author Olaf Wintermann |
1
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | */ |
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
36 | #ifndef UCX_LIST_H |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
37 | #define UCX_LIST_H |
1
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | |
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | #include "ucx.h" |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
40 | #include "allocator.h" |
1
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | |
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | #ifdef __cplusplus |
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | extern "C" { |
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44 | #endif |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
45 | |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
46 | /** |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
47 | * Loop statement for UCX lists. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
48 | * |
255
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
49 | * The first argument is the name of the iteration variable. The scope of |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
50 | * this variable is limited to the <code>UCX_FOREACH</code> statement. |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
51 | * |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
52 | * The second argument is a pointer to the list. In most cases this will be the |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
53 | * pointer to the first element of the list, but it may also be an arbitrary |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
54 | * element of the list. The iteration will then start with that element. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
55 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
56 | * @param list The first element of the list |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
57 | * @param elem The variable name of the element |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
58 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
59 | #define UCX_FOREACH(elem,list) \ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
60 | for (UcxList* elem = list ; elem != NULL ; elem = elem->next) |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
61 | |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
62 | /** |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
63 | * UCX list type. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
64 | * @see UcxList |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
65 | */ |
1
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | typedef struct UcxList UcxList; |
17
11dffb40cd91
new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
5
diff
changeset
|
67 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
68 | /** |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
69 | * UCX list structure. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
70 | */ |
1
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71 | struct UcxList { |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
72 | /** |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
73 | * List element payload. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
74 | */ |
1
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
75 | void *data; |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
76 | /** |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
77 | * Pointer to the next list element or <code>NULL</code>, if this is the |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
78 | * last element. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
79 | */ |
1
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
80 | UcxList *next; |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
81 | /** |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
82 | * Pointer to the previous list element or <code>NULL</code>, if this is |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
83 | * the first element. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
84 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
85 | UcxList *prev; |
1
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
86 | }; |
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
87 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
88 | /** |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
89 | * Creates an element-wise copy of a list. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
90 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
91 | * This function clones the specified list by creating new list elements and |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
92 | * copying the data with the specified copy_func(). If no copy_func() is |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
93 | * specified, a shallow copy is created and the new list will reference the |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
94 | * same data as the source list. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
95 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
96 | * @param list the list to copy |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
97 | * @param cpyfnc a pointer to the function that shall copy an element (may be |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
98 | * <code>NULL</code>) |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
99 | * @param data additional data for the copy_func() |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
100 | * @return a pointer to the copy |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
101 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
102 | UcxList *ucx_list_clone(UcxList *list, copy_func cpyfnc, void* data); |
17
11dffb40cd91
new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
5
diff
changeset
|
103 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
104 | /** |
255
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
105 | * Creates an element-wise copy of a list using a UcxAllocator. |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
106 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
107 | * See ucx_list_clone() for details. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
108 | * |
255
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
109 | * You might want to pass the allocator via the <code>data</code> parameter, |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
110 | * to access it within the copy function for making deep copies. |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
111 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
112 | * @param allocator the allocator to use |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
113 | * @param list the list to copy |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
114 | * @param cpyfnc a pointer to the function that shall copy an element (may be |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
115 | * <code>NULL</code>) |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
116 | * @param data additional data for the copy_func() |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
117 | * @return a pointer to the copy |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
118 | * @see ucx_list_clone() |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
119 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
120 | UcxList *ucx_list_clone_a(UcxAllocator *allocator, UcxList *list, |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
121 | copy_func cpyfnc, void* data); |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
122 | |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
123 | /** |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
124 | * Compares two UCX lists element-wise by using a compare function. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
125 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
126 | * Each element of the two specified lists are compared by using the specified |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
127 | * compare function and the additional data. The type and content of this |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
128 | * additional data depends on the cmp_func() used. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
129 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
130 | * If the list pointers denote elements within a list, the lists are compared |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
131 | * starting with the denoted elements. Thus any previous elements are not taken |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
132 | * into account. This might be useful to check, if certain list tails match |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
133 | * each other. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
134 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
135 | * @param list1 the first list |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
136 | * @param list2 the second list |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
137 | * @param cmpfnc the compare function |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
138 | * @param data additional data for the compare function |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
139 | * @return 1, if and only if the two lists equal element-wise, 0 otherwise |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
140 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
141 | int ucx_list_equals(const UcxList *list1, const UcxList *list2, |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
142 | cmp_func cmpfnc, void* data); |
1
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
143 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
144 | /** |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
145 | * Destroys the entire list. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
146 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
147 | * The members of the list are not automatically freed, so ensure they are |
255
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
148 | * otherwise referenced or destroyed by ucx_list_free_contents(). |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
149 | * Otherwise, a memory leak is likely to occur. |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
150 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
151 | * <b>Caution:</b> the argument <b>MUST</b> denote an entire list (i.e. a call |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
152 | * to ucx_list_first() on the argument must return the argument itself) |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
153 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
154 | * @param list the list to free |
255
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
155 | * @see ucx_list_free_contents() |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
156 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
157 | void ucx_list_free(UcxList *list); |
17
11dffb40cd91
new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
5
diff
changeset
|
158 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
159 | /** |
255
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
160 | * Destroys the entire list using a UcxAllocator. |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
161 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
162 | * See ucx_list_free() for details. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
163 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
164 | * @param allocator the allocator to use |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
165 | * @param list the list to free |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
166 | * @see ucx_list_free() |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
167 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
168 | void ucx_list_free_a(UcxAllocator *allocator, UcxList *list); |
17
11dffb40cd91
new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
5
diff
changeset
|
169 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
170 | /** |
255
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
171 | * Destroys the contents of the specified list by calling the specified |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
172 | * destructor on each of them. |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
173 | * |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
174 | * Note, that the contents are not usable afterwards and the list should be |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
175 | * destroyed with ucx_list_free(). |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
176 | * |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
177 | * @param list the list for which the contents shall be freed |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
178 | * @param destr the destructor function (e.g. stdlib free()) |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
179 | * @see ucx_list_free() |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
180 | */ |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
181 | void ucx_list_free_content(UcxList* list, ucx_destructor destr); |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
182 | |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
183 | |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
184 | /** |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
185 | * Inserts an element at the end of the list. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
186 | * |
70 | 187 | * This is generally an O(n) operation, as the end of the list is retrieved with |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
188 | * ucx_list_last(). |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
189 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
190 | * @param list the list where to append the data, or <code>NULL</code> to |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
191 | * create a new list |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
192 | * @param data the data to insert |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
193 | * @return <code>list</code>, if it is not <code>NULL</code> or a pointer to |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
194 | * the newly created list otherwise |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
195 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
196 | UcxList *ucx_list_append(UcxList *list, void *data); |
17
11dffb40cd91
new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
5
diff
changeset
|
197 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
198 | /** |
255
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
199 | * Inserts an element at the end of the list using a UcxAllocator. |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
200 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
201 | * See ucx_list_append() for details. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
202 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
203 | * @param allocator the allocator to use |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
204 | * @param list the list where to append the data, or <code>NULL</code> to |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
205 | * create a new list |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
206 | * @param data the data to insert |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
207 | * @return <code>list</code>, if it is not <code>NULL</code> or a pointer to |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
208 | * the newly created list otherwise |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
209 | * @see ucx_list_append() |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
210 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
211 | UcxList *ucx_list_append_a(UcxAllocator *allocator, UcxList *list, void *data); |
17
11dffb40cd91
new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
5
diff
changeset
|
212 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
213 | /** |
255
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
214 | * Inserts an element at the end of the list, if it is not present in the list. |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
215 | * |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
216 | * |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
217 | * @param list the list where to append the data, or <code>NULL</code> to |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
218 | * create a new list |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
219 | * @param data the data to insert |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
220 | * @param cmpfnc the compare function |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
221 | * @param cmpdata additional data for the compare function |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
222 | * @return <code>list</code>, if it is not <code>NULL</code> or a pointer to |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
223 | * the newly created list otherwise |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
224 | * @see ucx_list_append() |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
225 | */ |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
226 | UcxList *ucx_list_append_once(UcxList *list, void *data, |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
227 | cmp_func cmpfnc, void *cmpdata); |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
228 | |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
229 | /** |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
230 | * Inserts an element at the end of the list, if it is not present in the list, |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
231 | * using a UcxAllocator. |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
232 | * |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
233 | * See ucx_list_append() for details. |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
234 | * |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
235 | * @param allocator the allocator to use |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
236 | * @param list the list where to append the data, or <code>NULL</code> to |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
237 | * create a new list |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
238 | * @param data the data to insert |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
239 | * @param cmpfnc the compare function |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
240 | * @param cmpdata additional data for the compare function |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
241 | * @return <code>list</code>, if it is not <code>NULL</code> or a pointer to |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
242 | * the newly created list otherwise |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
243 | * @see ucx_list_append_a() |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
244 | */ |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
245 | UcxList *ucx_list_append_once_a(UcxAllocator *allocator, |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
246 | UcxList *list, void *data, cmp_func cmpfnc, void *cmpdata); |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
247 | |
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
248 | /** |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
249 | * Inserts an element at the beginning of the list. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
250 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
251 | * You <i>should</i> overwrite the old list pointer by calling |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
252 | * <code>mylist = ucx_list_prepend(mylist, mydata);</code>. However, you may |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
253 | * also perform successive calls of ucx_list_prepend() on the same list pointer, |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
254 | * as this function always searchs for the head of the list with |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
255 | * ucx_list_first(). |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
256 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
257 | * @param list the list where to insert the data or <code>NULL</code> to create |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
258 | * a new list |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
259 | * @param data the data to insert |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
260 | * @return a pointer to the new list head |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
261 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
262 | UcxList *ucx_list_prepend(UcxList *list, void *data); |
17
11dffb40cd91
new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
5
diff
changeset
|
263 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
264 | /** |
255
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
265 | * Inserts an element at the beginning of the list using a UcxAllocator. |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
266 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
267 | * See ucx_list_prepend() for details. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
268 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
269 | * @param allocator the allocator to use |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
270 | * @param list the list where to insert the data or <code>NULL</code> to create |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
271 | * a new list |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
272 | * @param data the data to insert |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
273 | * @return a pointer to the new list head |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
274 | * @see ucx_list_prepend() |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
275 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
276 | UcxList *ucx_list_prepend_a(UcxAllocator *allocator, UcxList *list, void *data); |
17
11dffb40cd91
new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
5
diff
changeset
|
277 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
278 | /** |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
279 | * Concatenates two lists. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
280 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
281 | * Either of the two arguments may be <code>NULL</code>. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
282 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
283 | * This function modifies the references to the next/previous element of |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
284 | * the last/first element of <code>list1</code>/<code> |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
285 | * list2</code>. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
286 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
287 | * @param list1 first list |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
288 | * @param list2 second list |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
289 | * @return if <code>list1</code> is <code>NULL</code>, <code>list2</code> is |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
290 | * returned, otherwise <code>list1</code> is returned |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
291 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
292 | UcxList *ucx_list_concat(UcxList *list1, UcxList *list2); |
17
11dffb40cd91
new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
5
diff
changeset
|
293 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
294 | /** |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
295 | * Returns the first element of a list. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
296 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
297 | * If the argument is the list pointer, it is directly returned. Otherwise |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
298 | * this function traverses to the first element of the list and returns the |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
299 | * list pointer. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
300 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
301 | * @param elem one element of the list |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
302 | * @return the first element of the list, the specified element is a member of |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
303 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
304 | UcxList *ucx_list_first(const UcxList *elem); |
17
11dffb40cd91
new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
5
diff
changeset
|
305 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
306 | /** |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
307 | * Returns the last element of a list. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
308 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
309 | * If the argument has no successor, it is the last element and therefore |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
310 | * directly returned. Otherwise this function traverses to the last element of |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
311 | * the list and returns it. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
312 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
313 | * @param elem one element of the list |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
314 | * @return the last element of the list, the specified element is a member of |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
315 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
316 | UcxList *ucx_list_last(const UcxList *elem); |
17
11dffb40cd91
new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
5
diff
changeset
|
317 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
318 | /** |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
319 | * Returns the list element at the specified index. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
320 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
321 | * @param list the list to retrieve the element from |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
322 | * @param index index of the element to return |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
323 | * @return the element at the specified index or <code>NULL</code>, if the |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
324 | * index is greater than the list size |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
325 | */ |
70 | 326 | UcxList *ucx_list_get(const UcxList *list, size_t index); |
17
11dffb40cd91
new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
5
diff
changeset
|
327 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
328 | /** |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
329 | * Returns the index of an element. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
330 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
331 | * @param list the list where to search for the element |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
332 | * @param elem the element to find |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
333 | * @return the index of the element or -1 if the list does not contain the |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
334 | * element |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
335 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
336 | ssize_t ucx_list_indexof(const UcxList *list, const UcxList *elem); |
17
11dffb40cd91
new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
5
diff
changeset
|
337 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
338 | /** |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
339 | * Returns the element count of the list. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
340 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
341 | * @param list the list whose elements are counted |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
342 | * @return the element count |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
343 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
344 | size_t ucx_list_size(const UcxList *list); |
17
11dffb40cd91
new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
5
diff
changeset
|
345 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
346 | /** |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
347 | * Returns the index of an element containing the specified data. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
348 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
349 | * This function uses a cmp_func() to compare the data of each list element |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
350 | * with the specified data. If no cmp_func is provided, the pointers are |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
351 | * compared. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
352 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
353 | * If the list contains the data more than once, the index of the first |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
354 | * occurrence is returned. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
355 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
356 | * @param list the list where to search for the data |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
357 | * @param elem the element data |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
358 | * @param cmpfnc the compare function |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
359 | * @param data additional data for the compare function |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
360 | * @return the index of the element containing the specified data or -1 if the |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
361 | * data is not found in this list |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
362 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
363 | ssize_t ucx_list_find(UcxList *list, void *elem, cmp_func cmpfnc, void *data); |
17
11dffb40cd91
new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
5
diff
changeset
|
364 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
365 | /** |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
366 | * Checks, if a list contains a specific element. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
367 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
368 | * An element is found, if ucx_list_find() returns a value greater than -1. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
369 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
370 | * @param list the list where to search for the data |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
371 | * @param elem the element data |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
372 | * @param cmpfnc the compare function |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
373 | * @param data additional data for the compare function |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
374 | * @return 1, if and only if the list contains the specified element data |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
375 | * @see ucx_list_find() |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
376 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
377 | int ucx_list_contains(UcxList *list, void *elem, cmp_func cmpfnc, void *data); |
1
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
378 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
379 | /** |
255
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
380 | * Sorts a UcxList with natural merge sort. |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
381 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
382 | * This function uses O(n) additional temporary memory for merge operations |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
383 | * that is automatically freed after each merge. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
384 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
385 | * As the head of the list might change, you <b>MUST</b> call this function |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
386 | * as follows: <code>mylist = ucx_list_sort(mylist, mycmpfnc, mydata);</code>. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
387 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
388 | * @param list the list to sort |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
389 | * @param cmpfnc the function that shall be used to compare the element data |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
390 | * @param data additional data for the cmp_func() |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
391 | * @return the sorted list |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
392 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
393 | UcxList *ucx_list_sort(UcxList *list, cmp_func cmpfnc, void *data); |
1
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
394 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
395 | /** |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
396 | * Removes an element from the list. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
397 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
398 | * If the first element is removed, the list pointer changes. So it is |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
399 | * <i>highly recommended</i> to <i>always</i> update the pointer by calling |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
400 | * <code>mylist = ucx_list_remove(mylist, myelem);</code>. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
401 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
402 | * @param list the list from which the element shall be removed |
70 | 403 | * @param element the element to remove |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
404 | * @return returns the updated list pointer or <code>NULL</code>, if the list |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
405 | * is now empty |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
406 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
407 | UcxList *ucx_list_remove(UcxList *list, UcxList *element); |
17
11dffb40cd91
new dav_query function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
5
diff
changeset
|
408 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
409 | /** |
255
bf19378aed58
updates UCX to version 0.11
Mike Becker <universe@uap-core.de>
parents:
110
diff
changeset
|
410 | * Removes an element from the list using a UcxAllocator. |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
411 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
412 | * See ucx_list_remove() for details. |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
413 | * |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
414 | * @param allocator the allocator to use |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
415 | * @param list the list from which the element shall be removed |
70 | 416 | * @param element the element to remove |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
417 | * @return returns the updated list pointer or <code>NULL</code>, if the list |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
418 | * @see ucx_list_remove() |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
419 | */ |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
420 | UcxList *ucx_list_remove_a(UcxAllocator *allocator, UcxList *list, |
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
421 | UcxList *element); |
1
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
422 | |
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
423 | #ifdef __cplusplus |
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
424 | } |
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
425 | #endif |
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
426 | |
5
88625853ae74
new webdav api + repository and key configuration + aes encryption
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
427 | #endif /* UCX_LIST_H */ |
1
1bcaac272cdf
added existing source code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
428 |