libg722_1
0.0.1
slist.h
1
/* slist.h -- generalised singly linked lists
2
3
Copyright (C) 2000, 2004, 2009, 2011-2019 Free Software Foundation,
4
Inc.
5
Written by Gary V. Vaughan, 2000
6
7
NOTE: The canonical source of this file is maintained with the
8
GNU Libtool package. Report bugs to bug-libtool@gnu.org.
9
10
GNU Libltdl is free software; you can redistribute it and/or
11
modify it under the terms of the GNU Lesser General Public
12
License as published by the Free Software Foundation; either
13
version 2 of the License, or (at your option) any later version.
14
15
As a special exception to the GNU Lesser General Public License,
16
if you distribute this file as part of a program or library that
17
is built using GNU Libtool, you may include this file under the
18
same distribution terms that you use for the rest of that program.
19
20
GNU Libltdl is distributed in the hope that it will be useful,
21
but WITHOUT ANY WARRANTY; without even the implied warranty of
22
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
GNU Lesser General Public License for more details.
24
25
You should have received a copy of the GNU Lesser General Public
26
License along with GNU Libltdl; see the file COPYING.LIB. If not, a
27
copy can be downloaded from http://www.gnu.org/licenses/lgpl.html,
28
or obtained by writing to the Free Software Foundation, Inc.,
29
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30
*/
31
32
/* A generalised list. This is deliberately transparent so that you
33
can make the NEXT field of all your chained data structures first,
34
and then cast them to '(SList *)' so that they can be manipulated
35
by this API.
36
37
Alternatively, you can generate raw SList elements using slist_new(),
38
and put the element data in the USERDATA field. Either way you
39
get to manage the memory involved by yourself.
40
*/
41
42
#if !defined SLIST_H
43
#define SLIST_H 1
44
45
#if defined LTDL
46
# include <libltdl/lt__glibc.h>
47
# include <libltdl/lt_system.h>
48
#else
49
# define LT_SCOPE
50
#endif
51
52
#include <stddef.h>
53
54
#if defined __cplusplus
55
extern
"C"
{
56
#endif
57
58
typedef
struct
slist
{
59
struct
slist
*next;
/* chain forward pointer*/
60
const
void
*userdata;
/* for boxed 'SList' item */
61
}
SList
;
62
63
typedef
void
* SListCallback (
SList
*item,
void
*userdata);
64
typedef
int
SListCompare (
const
SList
*item1,
const
SList
*item2,
65
void
*userdata);
66
67
LT_SCOPE
SList
*slist_concat (
SList
*head,
SList
*tail);
68
LT_SCOPE
SList
*slist_cons (
SList
*item,
SList
*
slist
);
69
70
LT_SCOPE
SList
*slist_delete (
SList
*
slist
,
void
(*delete_fct) (
void
*item));
71
LT_SCOPE
SList
*slist_remove (
SList
**phead, SListCallback *find,
72
void
*matchdata);
73
LT_SCOPE
SList
*slist_reverse (
SList
*
slist
);
74
LT_SCOPE
SList
*slist_sort (
SList
*
slist
, SListCompare *compare,
75
void
*userdata);
76
77
LT_SCOPE
SList
*slist_tail (
SList
*
slist
);
78
LT_SCOPE
SList
*slist_nth (
SList
*
slist
,
size_t
n);
79
LT_SCOPE
void
* slist_find (
SList
*
slist
, SListCallback *find,
80
void
*matchdata);
81
LT_SCOPE
size_t
slist_length (
SList
*
slist
);
82
83
LT_SCOPE
void
* slist_foreach (
SList
*
slist
, SListCallback *
foreach
,
84
void
*userdata);
85
86
LT_SCOPE
SList
*slist_box (
const
void
*userdata);
87
LT_SCOPE
void
* slist_unbox (
SList
*item);
88
89
#if defined __cplusplus
90
}
91
#endif
92
93
#if !defined LTDL
94
# undef LT_SCOPE
95
#endif
96
97
#endif
/*!defined SLIST_H*/
slist
Definition:
slist.h:58
libltdl
libltdl
slist.h
Generated by
1.8.15