diff options
| author | Tyge Løvset <[email protected]> | 2023-04-08 22:37:06 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-04-08 22:37:06 +0200 |
| commit | 43120f2863a67db416ec3b379eb820e2704cafb7 (patch) | |
| tree | f3b9917940f94c1582bc39ea6f56b735295ec861 /misc/examples/list_splice.c | |
| parent | e8be14dfc894eeac859f0287d4d5b4f4745c0585 (diff) | |
| parent | 6426ac05eb8c4dc1ab22aae2eb4139f9671981b7 (diff) | |
| download | STC-modified-43120f2863a67db416ec3b379eb820e2704cafb7.tar.gz STC-modified-43120f2863a67db416ec3b379eb820e2704cafb7.zip | |
Merge pull request #53 from tylov/dev42
Version 4.2 RC
Diffstat (limited to 'misc/examples/list_splice.c')
| -rw-r--r-- | misc/examples/list_splice.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/misc/examples/list_splice.c b/misc/examples/list_splice.c index f2f4946f..baebca29 100644 --- a/misc/examples/list_splice.c +++ b/misc/examples/list_splice.c @@ -16,25 +16,24 @@ void print_ilist(const char* s, clist_i list) int main () { - c_auto (clist_i, list1, list2) - { - list1 = c_make(clist_i, {1, 2, 3, 4, 5}); - list2 = c_make(clist_i, {10, 20, 30, 40, 50}); + clist_i list1 = c_make(clist_i, {1, 2, 3, 4, 5}); + clist_i list2 = c_make(clist_i, {10, 20, 30, 40, 50}); - print_ilist("list1:", list1); - print_ilist("list2:", list2); + print_ilist("list1:", list1); + print_ilist("list2:", list2); - clist_i_iter it = clist_i_advance(clist_i_begin(&list1), 2); - it = clist_i_splice(&list1, it, &list2); + clist_i_iter it = clist_i_advance(clist_i_begin(&list1), 2); + it = clist_i_splice(&list1, it, &list2); - puts("After splice"); - print_ilist("list1:", list1); - print_ilist("list2:", list2); + puts("After splice"); + print_ilist("list1:", list1); + print_ilist("list2:", list2); - clist_i_splice_range(&list2, clist_i_begin(&list2), &list1, it, clist_i_end(&list1)); + clist_i_splice_range(&list2, clist_i_begin(&list2), &list1, it, clist_i_end(&list1)); - puts("After splice_range"); - print_ilist("list1:", list1); - print_ilist("list2:", list2); - } + puts("After splice_range"); + print_ilist("list1:", list1); + print_ilist("list2:", list2); + + c_drop(clist_i, &list1, &list2); } |
