#include <stdio.h>
struct my_struct {
int a, b;
};
int
sort_cb(const void *d1, const void *d2)
{
const struct my_struct *x1, *x2;
l1 = d1;
l2 = d2;
return x1->a - x2->a;
}
int
main(void)
{
struct my_struct *d, *cur;
d = malloc(sizeof(*d));
d->a = 1;
d->b = 10;
d = malloc(sizeof(*d));
d->a = 2;
d->b = 20;
d = malloc(sizeof(*d));
d->a = 3;
d->b = 30;
printf("list=%p\n", list);
printf("\ta=%d, b=%d\n", cur->a, cur->b);
d = malloc(sizeof(*d));
d->a = 4;
d->b = 40;
printf("list after sort=%p\n", list);
printf("\ta=%d, b=%d\n", cur->a, cur->b);
if (tmp)
else
cur = NULL;
if (d != cur)
printf("wrong node! cur=%p\n", cur);
free(d);
printf("list=%p\n", list);
for (itr = list; itr != NULL; itr = itr->
next)
{
printf("\ta=%d, b=%d\n", cur->a, cur->b);
}
while (list)
{
struct my_struct);
free(aux);
}
return 0;
}
EINA_API Eina_Inlist * eina_inlist_find(Eina_Inlist *list, Eina_Inlist *item)
Finds given node in list, returns itself if found, NULL if not.
Definition: eina_inlist.c:433
EINA_API Eina_Inlist * eina_inlist_prepend(Eina_Inlist *list, Eina_Inlist *new_l)
Adds a new node to beginning of list.
Definition: eina_inlist.c:254
EINA_API Eina_Inlist * eina_inlist_sort(Eina_Inlist *head, Eina_Compare_Cb func)
Sorts a list according to the ordering func will return.
Definition: eina_inlist.c:804
#define EINA_INLIST_GET(Inlist)
Utility macro to get the inlist object of a struct.
Definition: eina_inlist.h:413
#define EINA_INLIST_FOREACH(list, it)
Definition: eina_inlist.h:832
EINA_API Eina_Inlist * eina_inlist_append_relative(Eina_Inlist *list, Eina_Inlist *new_l, Eina_Inlist *relative)
Adds a new node after the given relative item in list.
Definition: eina_inlist.c:274
#define EINA_INLIST_CONTAINER_GET(ptr, type)
Utility macro to get the container object of an inlist.
Definition: eina_inlist.h:415
#define EINA_INLIST
Used for declaring an inlist member in a struct.
Definition: eina_inlist.h:411
EINA_API Eina_Inlist * eina_inlist_promote(Eina_Inlist *list, Eina_Inlist *item)
Moves existing node to beginning of list.
Definition: eina_inlist.c:372
EINA_API Eina_Inlist * eina_inlist_append(Eina_Inlist *list, Eina_Inlist *new_l)
Adds a new node to end of a list.
Definition: eina_inlist.c:227
EINA_API Eina_Inlist * eina_inlist_demote(Eina_Inlist *list, Eina_Inlist *item)
Moves existing node to end of list.
Definition: eina_inlist.c:399
EINA_API Eina_Inlist * eina_inlist_remove(Eina_Inlist *list, Eina_Inlist *item)
Removes node from list.
Definition: eina_inlist.c:335
EINA_API int eina_shutdown(void)
Shuts down the Eina library.
Definition: eina_main.c:379
EINA_API int eina_init(void)
Initializes the Eina library.
Definition: eina_main.c:291
Inlined list type.
Definition: eina_inlist.h:405
Eina_Inlist * next
next node
Definition: eina_inlist.h:406