diff options
author | ng0 <ng0@n0.is> | 2019-09-08 12:33:09 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-09-08 12:33:09 +0000 |
commit | d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb (patch) | |
tree | 9efd18ea7d425652085ed0bd5e8e45604bc5f6b9 /src/set/ibf.h | |
parent | a0fce305c565c0937d917a92712f15e9c5736260 (diff) | |
download | gnunet-d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb.tar.gz gnunet-d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb.zip |
uncrustify as demanded.
Diffstat (limited to 'src/set/ibf.h')
-rw-r--r-- | src/set/ibf.h | 60 |
1 files changed, 28 insertions, 32 deletions
diff --git a/src/set/ibf.h b/src/set/ibf.h index dd0edc053..94079a39f 100644 --- a/src/set/ibf.h +++ b/src/set/ibf.h | |||
@@ -11,12 +11,12 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file set/ibf.h | 22 | * @file set/ibf.h |
@@ -42,8 +42,7 @@ extern "C" | |||
42 | /** | 42 | /** |
43 | * Keys that can be inserted into and removed from an IBF. | 43 | * Keys that can be inserted into and removed from an IBF. |
44 | */ | 44 | */ |
45 | struct IBF_Key | 45 | struct IBF_Key { |
46 | { | ||
47 | uint64_t key_val; | 46 | uint64_t key_val; |
48 | }; | 47 | }; |
49 | 48 | ||
@@ -51,8 +50,7 @@ struct IBF_Key | |||
51 | /** | 50 | /** |
52 | * Hash of an IBF key. | 51 | * Hash of an IBF key. |
53 | */ | 52 | */ |
54 | struct IBF_KeyHash | 53 | struct IBF_KeyHash { |
55 | { | ||
56 | uint32_t key_hash_val; | 54 | uint32_t key_hash_val; |
57 | }; | 55 | }; |
58 | 56 | ||
@@ -60,8 +58,7 @@ struct IBF_KeyHash | |||
60 | /** | 58 | /** |
61 | * Type of the count field of IBF buckets. | 59 | * Type of the count field of IBF buckets. |
62 | */ | 60 | */ |
63 | struct IBF_Count | 61 | struct IBF_Count { |
64 | { | ||
65 | int8_t count_val; | 62 | int8_t count_val; |
66 | }; | 63 | }; |
67 | 64 | ||
@@ -69,8 +66,8 @@ struct IBF_Count | |||
69 | /** | 66 | /** |
70 | * Size of one ibf bucket in bytes | 67 | * Size of one ibf bucket in bytes |
71 | */ | 68 | */ |
72 | #define IBF_BUCKET_SIZE (sizeof (struct IBF_Count) + sizeof (struct IBF_Key) + \ | 69 | #define IBF_BUCKET_SIZE (sizeof(struct IBF_Count) + sizeof(struct IBF_Key) + \ |
73 | sizeof (struct IBF_KeyHash)) | 70 | sizeof(struct IBF_KeyHash)) |
74 | 71 | ||
75 | 72 | ||
76 | /** | 73 | /** |
@@ -79,8 +76,7 @@ struct IBF_Count | |||
79 | * An IBF is a counting bloom filter that has the ability to restore | 76 | * An IBF is a counting bloom filter that has the ability to restore |
80 | * the hashes of its stored elements with high probability. | 77 | * the hashes of its stored elements with high probability. |
81 | */ | 78 | */ |
82 | struct InvertibleBloomFilter | 79 | struct InvertibleBloomFilter { |
83 | { | ||
84 | /** | 80 | /** |
85 | * How many cells does this IBF have? | 81 | * How many cells does this IBF have? |
86 | */ | 82 | */ |
@@ -123,10 +119,10 @@ struct InvertibleBloomFilter | |||
123 | * @param buf buffer to write the data to | 119 | * @param buf buffer to write the data to |
124 | */ | 120 | */ |
125 | void | 121 | void |
126 | ibf_write_slice (const struct InvertibleBloomFilter *ibf, | 122 | ibf_write_slice(const struct InvertibleBloomFilter *ibf, |
127 | uint32_t start, | 123 | uint32_t start, |
128 | uint32_t count, | 124 | uint32_t count, |
129 | void *buf); | 125 | void *buf); |
130 | 126 | ||
131 | 127 | ||
132 | /** | 128 | /** |
@@ -138,10 +134,10 @@ ibf_write_slice (const struct InvertibleBloomFilter *ibf, | |||
138 | * @param ibf the ibf to write to | 134 | * @param ibf the ibf to write to |
139 | */ | 135 | */ |
140 | void | 136 | void |
141 | ibf_read_slice (const void *buf, | 137 | ibf_read_slice(const void *buf, |
142 | uint32_t start, | 138 | uint32_t start, |
143 | uint32_t count, | 139 | uint32_t count, |
144 | struct InvertibleBloomFilter *ibf); | 140 | struct InvertibleBloomFilter *ibf); |
145 | 141 | ||
146 | 142 | ||
147 | /** | 143 | /** |
@@ -151,7 +147,7 @@ ibf_read_slice (const void *buf, | |||
151 | * @return a key | 147 | * @return a key |
152 | */ | 148 | */ |
153 | struct IBF_Key | 149 | struct IBF_Key |
154 | ibf_key_from_hashcode (const struct GNUNET_HashCode *hash); | 150 | ibf_key_from_hashcode(const struct GNUNET_HashCode *hash); |
155 | 151 | ||
156 | 152 | ||
157 | /** | 153 | /** |
@@ -162,7 +158,7 @@ ibf_key_from_hashcode (const struct GNUNET_HashCode *hash); | |||
162 | * @param dst hashcode to store the result in | 158 | * @param dst hashcode to store the result in |
163 | */ | 159 | */ |
164 | void | 160 | void |
165 | ibf_hashcode_from_key (struct IBF_Key key, struct GNUNET_HashCode *dst); | 161 | ibf_hashcode_from_key(struct IBF_Key key, struct GNUNET_HashCode *dst); |
166 | 162 | ||
167 | 163 | ||
168 | /** | 164 | /** |
@@ -173,7 +169,7 @@ ibf_hashcode_from_key (struct IBF_Key key, struct GNUNET_HashCode *dst); | |||
173 | * @return the newly created invertible bloom filter, NULL on error | 169 | * @return the newly created invertible bloom filter, NULL on error |
174 | */ | 170 | */ |
175 | struct InvertibleBloomFilter * | 171 | struct InvertibleBloomFilter * |
176 | ibf_create (uint32_t size, uint8_t hash_num); | 172 | ibf_create(uint32_t size, uint8_t hash_num); |
177 | 173 | ||
178 | 174 | ||
179 | /** | 175 | /** |
@@ -183,7 +179,7 @@ ibf_create (uint32_t size, uint8_t hash_num); | |||
183 | * @param key the element's hash code | 179 | * @param key the element's hash code |
184 | */ | 180 | */ |
185 | void | 181 | void |
186 | ibf_insert (struct InvertibleBloomFilter *ibf, struct IBF_Key key); | 182 | ibf_insert(struct InvertibleBloomFilter *ibf, struct IBF_Key key); |
187 | 183 | ||
188 | 184 | ||
189 | /** | 185 | /** |
@@ -193,7 +189,7 @@ ibf_insert (struct InvertibleBloomFilter *ibf, struct IBF_Key key); | |||
193 | * @param key the element's hash code | 189 | * @param key the element's hash code |
194 | */ | 190 | */ |
195 | void | 191 | void |
196 | ibf_remove (struct InvertibleBloomFilter *ibf, struct IBF_Key key); | 192 | ibf_remove(struct InvertibleBloomFilter *ibf, struct IBF_Key key); |
197 | 193 | ||
198 | 194 | ||
199 | /** | 195 | /** |
@@ -204,8 +200,8 @@ ibf_remove (struct InvertibleBloomFilter *ibf, struct IBF_Key key); | |||
204 | * @param ibf2 IBF that will be subtracted from ibf1 | 200 | * @param ibf2 IBF that will be subtracted from ibf1 |
205 | */ | 201 | */ |
206 | void | 202 | void |
207 | ibf_subtract (struct InvertibleBloomFilter *ibf1, | 203 | ibf_subtract(struct InvertibleBloomFilter *ibf1, |
208 | const struct InvertibleBloomFilter *ibf2); | 204 | const struct InvertibleBloomFilter *ibf2); |
209 | 205 | ||
210 | 206 | ||
211 | /** | 207 | /** |
@@ -221,9 +217,9 @@ ibf_subtract (struct InvertibleBloomFilter *ibf1, | |||
221 | * #GNUNET_SYSERR if the decoding has failed | 217 | * #GNUNET_SYSERR if the decoding has failed |
222 | */ | 218 | */ |
223 | int | 219 | int |
224 | ibf_decode (struct InvertibleBloomFilter *ibf, | 220 | ibf_decode(struct InvertibleBloomFilter *ibf, |
225 | int *ret_side, | 221 | int *ret_side, |
226 | struct IBF_Key *ret_id); | 222 | struct IBF_Key *ret_id); |
227 | 223 | ||
228 | 224 | ||
229 | /** | 225 | /** |
@@ -232,7 +228,7 @@ ibf_decode (struct InvertibleBloomFilter *ibf, | |||
232 | * @param ibf the IBF to copy | 228 | * @param ibf the IBF to copy |
233 | */ | 229 | */ |
234 | struct InvertibleBloomFilter * | 230 | struct InvertibleBloomFilter * |
235 | ibf_dup (const struct InvertibleBloomFilter *ibf); | 231 | ibf_dup(const struct InvertibleBloomFilter *ibf); |
236 | 232 | ||
237 | 233 | ||
238 | /** | 234 | /** |
@@ -242,7 +238,7 @@ ibf_dup (const struct InvertibleBloomFilter *ibf); | |||
242 | * @param ibf the intertible bloom filter to destroy | 238 | * @param ibf the intertible bloom filter to destroy |
243 | */ | 239 | */ |
244 | void | 240 | void |
245 | ibf_destroy (struct InvertibleBloomFilter *ibf); | 241 | ibf_destroy(struct InvertibleBloomFilter *ibf); |
246 | 242 | ||
247 | 243 | ||
248 | #if 0 /* keep Emacsens' auto-indent happy */ | 244 | #if 0 /* keep Emacsens' auto-indent happy */ |