diff options
Diffstat (limited to 'libraries/eina/src/examples/eina_list_02.c')
-rw-r--r-- | libraries/eina/src/examples/eina_list_02.c | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/libraries/eina/src/examples/eina_list_02.c b/libraries/eina/src/examples/eina_list_02.c deleted file mode 100644 index 5fe31e8..0000000 --- a/libraries/eina/src/examples/eina_list_02.c +++ /dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | //Compile with: | ||
2 | //gcc -g eina_list_02.c -o eina_list_02 `pkg-config --cflags --libs eina` | ||
3 | |||
4 | #include <stdio.h> | ||
5 | #include <string.h> | ||
6 | #include <Eina.h> | ||
7 | |||
8 | int | ||
9 | main(int argc, char **argv) | ||
10 | { | ||
11 | Eina_List *list = NULL, *other_list = NULL; | ||
12 | Eina_List *l; | ||
13 | void *data; | ||
14 | int cmp_result; | ||
15 | Eina_Compare_Cb cmp_func = (Eina_Compare_Cb)strcmp; | ||
16 | |||
17 | eina_init(); | ||
18 | |||
19 | list = eina_list_append(list, "starbuck"); | ||
20 | list = eina_list_append(list, "appolo"); | ||
21 | list = eina_list_append(list, "boomer"); | ||
22 | |||
23 | data = eina_list_search_unsorted(list, cmp_func, "boomer"); | ||
24 | l = eina_list_search_unsorted_list(list, cmp_func, "boomer"); | ||
25 | if (l->data != data) | ||
26 | return 1; | ||
27 | |||
28 | list = eina_list_sort(list, 0, cmp_func); | ||
29 | |||
30 | data = eina_list_search_sorted(list, cmp_func, "starbuck"); | ||
31 | l = eina_list_search_sorted_list(list, cmp_func, "starbuck"); | ||
32 | if (l->data != data) | ||
33 | return 1; | ||
34 | |||
35 | list = eina_list_sorted_insert(list, cmp_func, "helo"); | ||
36 | |||
37 | l = eina_list_search_sorted_near_list(list, cmp_func, "hera", &cmp_result); | ||
38 | if (cmp_result > 0) | ||
39 | list = eina_list_prepend_relative_list(list, "hera", l); | ||
40 | else if (cmp_result < 0) | ||
41 | list = eina_list_append_relative_list(list, "hera", l); | ||
42 | |||
43 | l = eina_list_search_sorted_list(list, cmp_func, "boomer"); | ||
44 | list = eina_list_split_list(list, l, &other_list); | ||
45 | |||
46 | other_list = eina_list_sort(other_list, 0, cmp_func); | ||
47 | |||
48 | list = eina_list_sorted_merge(list, other_list, cmp_func); | ||
49 | |||
50 | eina_list_free(list); | ||
51 | |||
52 | eina_shutdown(); | ||
53 | |||
54 | return 0; | ||
55 | } | ||