1 /* str-list.h: declarations for string lists.
3 Copyright 1993, 1994, 2007, 2008 Karl Berry.
4 Copyright 1999, 2005 Olaf Weber.
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with this library; if not, see <http://www.gnu.org/licenses/>. */
19 #ifndef KPATHSEA_STR_LIST_H
20 #define KPATHSEA_STR_LIST_H
22 #include <kpathsea/c-proto.h>
23 #include <kpathsea/types.h>
26 /* Lists of strings; used for, e.g., directory lists. */
34 #define STR_LIST_LENGTH(l) ((l).length)
35 #define STR_LIST(l) ((l).list)
36 #define STR_LIST_ELT(l, n) STR_LIST (l)[n]
37 #define STR_LIST_LAST_ELT(l) STR_LIST_ELT (l, STR_LIST_LENGTH (l) - 1)
39 /* Return a new, empty, list. */
40 extern str_list_type str_list_init P1H(void);
42 /* Append the string S to the list L. It's up to the caller to not
43 deallocate S; we don't copy it. Also up to the caller to terminate
44 the list with a null entry. */
45 extern void str_list_add P2H(str_list_type *l, string s);
47 /* Append all the elements from MORE to TARGET. */
48 extern void str_list_concat P2H(str_list_type * target, str_list_type more);
50 /* Free the space for the list elements (but not the list elements
52 extern void str_list_free P1H(str_list_type *l);
54 /* Append each element of MORE to each element of TARGET. */
55 extern void str_list_concat_elements
56 P2H(str_list_type *target, str_list_type more);
58 /* Remove duplicate elements from L, freeing their space. */
59 extern void str_list_uniqify P1H(str_list_type *l);
61 #endif /* not KPATHSEA_STR_LIST_H */