forked from collectd/collectd
/
utils_llist.h
61 lines (51 loc) · 1.53 KB
/
utils_llist.h
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**
* collectd - src/utils_llist.h
* Copyright (C) 2006 Florian Forster <octo at verplant.org>
*
* This program is free software; you can redistribute it and/
* or modify it under the terms of the GNU General Public Li-
* cence as published by the Free Software Foundation; only
* version 2 of the Licence is applicable.
*
* This program is distributed in the hope that it will be use-
* ful, but WITHOUT ANY WARRANTY; without even the implied war-
* ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public Licence for more details.
*
* You should have received a copy of the GNU General Public
* Licence along with this program; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
* USA.
*
* Authors:
* Florian Forster <octo at verplant.org>
*/
#ifndef UTILS_LLIST_H
#define UTILS_LLIST_H 1
/*
* Data types
*/
struct llentry_s
{
char *key;
void *value;
struct llentry_s *next;
};
typedef struct llentry_s llentry_t;
struct llist_s;
typedef struct llist_s llist_t;
/*
* Functions
*/
llist_t *llist_create (void);
void llist_destroy (llist_t *l);
llentry_t *llentry_create (char *key, void *value);
void llentry_destroy (llentry_t *e);
void llist_append (llist_t *l, llentry_t *e);
void llist_prepend (llist_t *l, llentry_t *e);
void llist_remove (llist_t *l, llentry_t *e);
int llist_size (llist_t *l);
llentry_t *llist_search (llist_t *l, const char *key);
llentry_t *llist_head (llist_t *l);
llentry_t *llist_tail (llist_t *l);
#endif /* UTILS_LLIST_H */