Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
ordered-set.h
Go to the documentation of this file.
1/*
2 * The MIT License (MIT)
3 *
4 * Copyright © 2015-2016 Franklin "Snaipe" Mathieu <http://snai.pe/>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24#ifndef CRITERION_ORDERED_SET_H_
25#define CRITERION_ORDERED_SET_H_
26
27#include "../types.h"
28
29typedef int (*f_criterion_cmp)(void *, void *);
30
33 size_t size;
35 void(*const dtor)(void *, void *);
36};
37
41
43
45 void (*dtor)(void *, void *));
46
48 void *ptr,
49 size_t size);
50
52
53#define FOREACH_SET(Elt, Set) \
54 for (struct criterion_ordered_set_node *n = Set->first; n; n = n->next) \
55 for (int cond = 1; cond;) \
56 for (Elt = (void *) (n + 1); cond && (cond = 0, 1);)
57
58#endif /* !CRITERION_ORDERED_SET_H_ */
#define CR_BEGIN_C_API
Definition common.h:54
#define CR_API
Definition common.h:128
#define CR_END_C_API
Definition common.h:55
CR_BEGIN_C_API CR_API struct criterion_ordered_set * new_ordered_set(f_criterion_cmp cmp, void(*dtor)(void *, void *))
CR_API void * insert_ordered_set(struct criterion_ordered_set *l, void *ptr, size_t size)
int(* f_criterion_cmp)(void *, void *)
Definition ordered-set.h:29
struct criterion_ordered_set_node * next
Definition ordered-set.h:39
struct criterion_ordered_set_node * first
Definition ordered-set.h:32
f_criterion_cmp cmp
Definition ordered-set.h:34
void(*const dtor)(void *, void *)
Definition ordered-set.h:35
Types for tests.