2 // gcc -g eina_inlist_01.c -o eina_inlist_01 `pkg-config --cflags --libs eina`
13 sort_cb(const void *d1, const void *d2)
15 const Eina_Inlist *l1, *l2;
16 const struct my_struct *x1, *x2;
21 x1 = EINA_INLIST_CONTAINER_GET(l1, struct my_struct);
22 x2 = EINA_INLIST_CONTAINER_GET(l2, struct my_struct);
30 struct my_struct *d, *cur;
31 Eina_Inlist *list, *itr, *tmp;
35 d = malloc(sizeof(*d));
38 list = eina_inlist_append(NULL, EINA_INLIST_GET(d));
40 d = malloc(sizeof(*d));
43 list = eina_inlist_append(list, EINA_INLIST_GET(d));
45 d = malloc(sizeof(*d));
48 list = eina_inlist_prepend(list, EINA_INLIST_GET(d));
50 printf("list=%p\n", list);
51 EINA_INLIST_FOREACH(list, cur)
52 printf("\ta=%d, b=%d\n", cur->a, cur->b);
54 list = eina_inlist_promote(list, EINA_INLIST_GET(d));
56 d = malloc(sizeof(*d));
59 list = eina_inlist_append_relative(list, EINA_INLIST_GET(d), list);
61 list = eina_inlist_demote(list, EINA_INLIST_GET(d));
63 list = eina_inlist_sort(list, sort_cb);
65 printf("list after sort=%p\n", list);
66 EINA_INLIST_FOREACH(list, cur)
67 printf("\ta=%d, b=%d\n", cur->a, cur->b);
69 tmp = eina_inlist_find(list, EINA_INLIST_GET(d));
71 cur = EINA_INLIST_CONTAINER_GET(tmp, struct my_struct);
76 printf("wrong node! cur=%p\n", cur);
78 list = eina_inlist_remove(list, EINA_INLIST_GET(d));
80 printf("list=%p\n", list);
81 for (itr = list; itr != NULL; itr = itr->next)
83 cur = EINA_INLIST_CONTAINER_GET(itr, struct my_struct);
84 printf("\ta=%d, b=%d\n", cur->a, cur->b);
89 struct my_struct *aux = EINA_INLIST_CONTAINER_GET(list,
91 list = eina_inlist_remove(list, list);