diff options
| author | Tyge Lovset <[email protected]> | 2023-06-29 09:32:39 +0200 |
|---|---|---|
| committer | Tyge Lovset <[email protected]> | 2023-06-29 10:48:03 +0200 |
| commit | 764d6b5a831c4ff58fb717a1360fe80f691a424d (patch) | |
| tree | 55b0353d1952f749dc34d4286b25970de4039545 /misc/examples/intrusive.c | |
| parent | 5096c3c951f6b99e9d6ee04a21531e226153cca9 (diff) | |
| download | STC-modified-764d6b5a831c4ff58fb717a1360fe80f691a424d.tar.gz STC-modified-764d6b5a831c4ff58fb717a1360fe80f691a424d.zip | |
Usage change: comparison is no longer enabled when specifying i_val for cvec, cdeq and clist (like cstack and cqueue). Comparison functions are still required when specifying i_valclass. For fundamental/native types like integers, floats etc., define i_native_cmp along with i_val instead of i_less/i_cmp/i_eq.
Diffstat (limited to 'misc/examples/intrusive.c')
| -rw-r--r-- | misc/examples/intrusive.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/misc/examples/intrusive.c b/misc/examples/intrusive.c index 0d503575..0d59c5ab 100644 --- a/misc/examples/intrusive.c +++ b/misc/examples/intrusive.c @@ -4,7 +4,8 @@ #define i_type List #define i_val int -#include <stc/clist.h> +#define i_native_cmp +#include <stc/clist.h> void printList(List list) { printf("list:"); @@ -16,7 +17,7 @@ void printList(List list) { int main() { List list = {0}; c_forlist (i, int, {6, 9, 3, 1, 7, 4, 5, 2, 8}) - List_push_back_node(&list, c_new(List_node, {0, *i.ref})); + List_push_back_node(&list, c_new(List_node, {.value=*i.ref})); printList(list); |
