summaryrefslogtreecommitdiff
path: root/include/idlist.h
blob: c006a3288f436c1ff7e49602b880917baa1629d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
 * idlist.h
 *
 * IDList - List datatype implementation. Element can be taken by id only.
 *
 * IDList is used by the Painter module and loadable texts.
 *
 * */

struct idlist {
    size_t          id;
    void           *obj;
    struct idlist  *next;
    struct idlist  *prev;
};

struct idlist  *list_new();
struct idlist  *list_append(struct idlist *list);
struct idlist  *list_get(const struct idlist *list, size_t id);
void            list_rm_node(struct idlist *node);
void            list_foreach(struct idlist *list, void (*job)(void *));
void            list_destroy(struct idlist *list);