-
Notifications
You must be signed in to change notification settings - Fork 0
/
link.h
64 lines (56 loc) · 1.77 KB
/
link.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
62
63
64
/*
* libslack - https://libslack.org
*
* Copyright (C) 1999-2004, 2010, 2020-2023 raf <raf@raf.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <https://www.gnu.org/licenses/>.
*
* 20230824 raf <raf@raf.org>
*/
#ifndef LIBSLACK_LINK_H
#define LIBSLACK_LINK_H
#include <slack/hdr.h>
typedef struct slink_t slink_t;
typedef struct dlink_t dlink_t;
struct slink_t
{
void *next;
};
struct dlink_t
{
void *next;
void *prev;
};
_begin_decls
int slink_has_next(void *link);
void *slink_next(void *link);
int dlink_has_next(void *link);
void *dlink_next(void *link);
int dlink_has_prev(void *link);
void *dlink_prev(void *link);
void *slink_insert(void *link, void *item);
void *dlink_insert(void *link, void *item);
void *slink_remove(void *link);
void *dlink_remove(void *link);
void *slink_freelist_init(void *freelist, size_t nelem, size_t size);
void *dlink_freelist_init(void *freelist, size_t nelem, size_t size);
void *slink_freelist_attach(void *freelist1, void *freelist2);
void *dlink_freelist_attach(void *freelist1, void *freelist2);
void *slink_alloc(void **freelist);
void *dlink_alloc(void **freelist);
void *slink_free(void **freelist, void *item);
void *dlink_free(void **freelist, void *item);
_end_decls
#endif
/* vi:set ts=4 sw=4: */