aboutsummaryrefslogtreecommitdiff
path: root/src/param.h
blob: 6fd0ba0cefff810dca2239fbde2b275ffc1d13a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef MAGI_INCLUDED_PARAM
#define MAGI_INCLUDED_PARAM


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Parameter
 */
struct magi_param {
    char * name;
    char * data;
};

struct magi_param_list {
    struct magi_param_list * next;
    struct magi_param        item;
};


/* Adds *item to the begining of *list, item and list are dereferencable;
 * Returns null in case of error. */
int magi_param_list_add(struct magi_param_list ** list,
                        struct magi_param *       item);

/* Searchs for first node in list: node.name == name, name is C-string;
 * Returns node itself if succeed, otherwise result is null. */
struct magi_param * magi_param_list_get(struct magi_param_list * list,
                                        const char *             name);

/* Destroys list; list is not valid after destruction. */
void magi_param_list_destroy(struct magi_param_list * list);


#endif