chiark / gitweb /
gpg agent lockup fix: Interrupt main loop when active_connections_value==0
[gnupg2.git] / common / strlist.h
1 /* strlist.h
2  *      Copyright (C) 1998, 2000, 2001, 2006 Free Software Foundation, Inc.
3  *
4  * This file is part of GnuPG.
5  *
6  * GnuPG is free software; you can redistribute it and/or modify it
7  * under the terms of either
8  *
9  *   - the GNU Lesser General Public License as published by the Free
10  *     Software Foundation; either version 3 of the License, or (at
11  *     your option) any later version.
12  *
13  * or
14  *
15  *   - the GNU General Public License as published by the Free
16  *     Software Foundation; either version 2 of the License, or (at
17  *     your option) any later version.
18  *
19  * or both in parallel, as here.
20  *
21  * GnuPG is distributed in the hope that it will be useful, but
22  * WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24  * General Public License for more details.
25  *
26  * You should have received a copies of the GNU General Public License
27  * and the GNU Lesser General Public License along with this program;
28  * if not, see <https://www.gnu.org/licenses/>.
29  */
30
31 #ifndef GNUPG_COMMON_STRLIST_H
32 #define GNUPG_COMMON_STRLIST_H
33
34 struct string_list
35 {
36   struct string_list *next;
37   unsigned int flags;
38   char d[1];
39 };
40 typedef struct string_list *strlist_t;
41
42 void    free_strlist (strlist_t sl);
43 void    free_strlist_wipe (strlist_t sl);
44
45 strlist_t add_to_strlist (strlist_t *list, const char *string);
46 strlist_t add_to_strlist_try (strlist_t *list, const char *string);
47
48 strlist_t add_to_strlist2( strlist_t *list, const char *string, int is_utf8);
49
50 strlist_t append_to_strlist (strlist_t *list, const char *string);
51 strlist_t append_to_strlist_try (strlist_t *list, const char *string);
52 strlist_t append_to_strlist2 (strlist_t *list, const char *string,
53                               int is_utf8);
54
55 strlist_t strlist_copy (strlist_t list);
56
57 strlist_t strlist_prev (strlist_t head, strlist_t node);
58 strlist_t strlist_last (strlist_t node);
59 char * strlist_pop (strlist_t *list);
60
61 strlist_t strlist_find (strlist_t haystack, const char *needle);
62 int strlist_length (strlist_t list);
63
64 strlist_t strlist_rev (strlist_t *haystack);
65
66 #define FREE_STRLIST(a) do { free_strlist((a)); (a) = NULL ; } while(0)
67
68
69 #endif /*GNUPG_COMMON_STRLIST_H*/