1 /* str-llist.h: a linked list of strings,
3 It's pretty sad that both this and str-list exist; the reason is
4 that C cannot express iterators very well, and I don't want to change
7 Copyright 1993, 1994, 2008, 2010, 2014 Karl Berry.
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public License
20 along with this library; if not, see <http://www.gnu.org/licenses/>. */
25 #include <kpathsea/c-proto.h>
26 #include <kpathsea/simpletypes.h>
32 /* It's a little bizarre to be using the same type for the list and the
33 elements of the list, but no reason not to in this case, I think --
34 we never need a NULL string in the middle of the list, and an extra
35 NULL/NULL element always at the end is inconsequential. */
41 struct str_llist_elt
*next
;
43 typedef struct str_llist_elt str_llist_elt_type
;
44 typedef struct str_llist_elt
*str_llist_type
;
46 #define STR_LLIST(sl) ((sl).str)
47 #define STR_LLIST_MOVED(sl) ((sl).moved)
48 #define STR_LLIST_NEXT(sl) ((sl).next)
50 #ifdef MAKE_KPSE_DLL /* libkpathsea internal only */
52 /* Add the new string E to the end of the list L. */
53 extern void str_llist_add (str_llist_type
*l
, string e
);
55 /* Reorganize L so that E is below only other elements that have already
56 been moved. Set `moved' member for E. */
57 extern void str_llist_float (str_llist_type
*l
, str_llist_elt_type
*e
);
59 #endif /* MAKE_KPSE_DLL */
65 #endif /* not STR_LLIST_H */