diff options
| author | _Tradam <[email protected]> | 2023-09-08 01:29:47 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-09-08 01:29:47 +0000 |
| commit | 3c76c7f3d5db3f9586a90d03f8fbb02d79de9acd (patch) | |
| tree | afbe4b540967223911f7c5de36559b82154f02f3 /misc/examples/intrusive.c | |
| parent | 0841165881871ee01b782129be681209aeed2423 (diff) | |
| parent | 1a72205fe05c2375cfd380dd8381a8460d9ed8d1 (diff) | |
| download | STC-modified-modified.tar.gz STC-modified-modified.zip | |
Diffstat (limited to 'misc/examples/intrusive.c')
| -rw-r--r-- | misc/examples/intrusive.c | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/misc/examples/intrusive.c b/misc/examples/intrusive.c deleted file mode 100644 index 0d503575..00000000 --- a/misc/examples/intrusive.c +++ /dev/null @@ -1,32 +0,0 @@ -// Example of clist using the node API. - -#include <stdio.h> - -#define i_type List -#define i_val int -#include <stc/clist.h> - -void printList(List list) { - printf("list:"); - c_foreach (i, List, list) - printf(" %d", *i.ref); - puts(""); -} - -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})); - - printList(list); - - puts("Sort list"); - List_sort(&list); - printList(list); - - puts("Remove nodes from list"); - while (!List_empty(&list)) - c_free(List_unlink_after_node(&list, list.last)); - - printList(list); -} |
