Go to the source code of this file.
◆ ITEM [1/2]
Definition at line 14 of file set.c.
◆ ITEM [2/2]
Definition at line 14 of file set.c.
◆ ITEM_DEBUG
Definition at line 68 of file set.c.
◆ ITEM_DELETE
Definition at line 67 of file set.c.
◆ ITEM_EQ
Definition at line 66 of file set.c.
◆ ITEM_HASH [1/2]
Definition at line 15 of file set.c.
◆ ITEM_HASH [2/2]
Definition at line 15 of file set.c.
◆ NAME [1/2]
Definition at line 16 of file set.c.
◆ NAME [2/2]
Definition at line 16 of file set.c.
◆ complex_data_debug()
- Examples
- container/set.c.
Definition at line 54 of file set.c.
54 {
55 fprintf(
stream,
"complex_data@%p {\n", (
void*)self);
62}
static DC_PUBLIC void dc_debug_fmt_print(dc_debug_fmt fmt, FILE *stream, const char *format,...)
static DC_PUBLIC dc_debug_fmt dc_debug_fmt_scope_end(dc_debug_fmt fmt)
static DC_PUBLIC dc_debug_fmt dc_debug_fmt_scope_begin(dc_debug_fmt fmt)
static DC_PUBLIC FILE * stream(SELF *self)
◆ complex_data_delete()
◆ complex_data_eq()
- Examples
- container/set.c.
Definition at line 41 of file set.c.
41 {
42 return a->flag == b->flag && strcmp(a->name, b->name) == 0 && a->value == b->value;
43}
◆ complex_data_hash()
| size_t complex_data_hash |
( |
struct complex_data const * | self | ) |
|
|
static |
- Examples
- container/set.c.
Definition at line 45 of file set.c.
45 {
46 const char* name_ptr = self->name;
48 int32_t value = (int32_t)self->value;
51 return hash;
52}
static DC_PUBLIC size_t dc_hash_combine(size_t seed, size_t h)
static DC_PUBLIC uint64_t dc_fnv1a_str_const(const char *const *s)
◆ example_complex_set()
| void example_complex_set |
( |
| ) |
|
|
static |
- Examples
- container/set.c.
Definition at line 72 of file set.c.
72 {
74 DC_SCOPED(complex_set)
set = complex_set_new(stdalloc_get_ref());
75
76 struct complex_data item1 = {.flag =
true, .name = strdup(
"first"), .value = 42};
77 struct complex_data item2 = {.flag =
false, .name = strdup(
"second"), .value = 100};
78
79 complex_set_add(&
set, item1);
80 complex_set_add(&
set, item2);
81
82 struct complex_data lookup = {.flag =
true, .name = strdup(
"first"), .value = 42};
85
87}
static DC_PUBLIC void set(SELF *self, INDEX_TYPE index, bool value)
static DC_PUBLIC dc_debug_fmt dc_debug_fmt_new()
#define DC_ASSERT(expr,...)
#define DC_SCOPED(type,...)
RAII in C. Call the destructor when the variable goes out of scope.
◆ example_integer_set()
| void example_integer_set |
( |
| ) |
|
|
static |
- Examples
- container/set.c.
Definition at line 19 of file set.c.
19 {
21 DC_SCOPED(int_set)
set = int_set_new(stdalloc_get_ref());
22
23 for (int i = 0; i < 10; i++) {
25 }
26
28 printf("\n");
29
31}
#define DC_FOR_CONST(TYPE, INSTANCE, ITER, ITEM)
◆ main()
Definition at line 89 of file set.c.
89 {
92 return 0;
93}
static void example_complex_set()
static void example_integer_set()