OSDN Git Service

Replace some malloc and strdup by xmalloc and xstrdup respectively
[android-x86/external-parted.git] / parted / strlist.h
1 /*
2     parted - a frontend to libparted
3     Copyright (C) 1999, 2000, 2001, 2007 Free Software Foundation, Inc.
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20 #ifndef STRLIST_H_INCLUDED
21 #define STRLIST_H_INCLUDED
22
23 #include <config.h>
24
25 #include <wchar.h>
26
27 #ifndef ENABLE_NLS
28 #       define L_(str) str
29 #       ifdef wchar_t
30 #               undef wchar_t
31 #       endif
32 #       define wchar_t char
33 #endif
34
35 typedef struct _StrList StrList;
36 struct _StrList {
37         StrList*        next;
38         const wchar_t*  str;
39 };
40
41 extern char* language;
42 extern char* gettext_charset;
43 extern char* term_charset;
44
45 extern StrList* str_list_create (const char* first, ...);
46 extern StrList* str_list_create_unique (const char* first, ...);
47 extern void str_list_destroy (StrList* list);
48 extern void str_list_destroy_node (StrList* list);
49
50 extern StrList* str_list_duplicate (const StrList* list);
51 extern StrList* str_list_duplicate_node (const StrList* list);
52 extern StrList* str_list_insert (StrList* list, const char* str);
53 extern StrList* str_list_append (StrList* list, const char* str);
54 extern StrList* str_list_append_unique (StrList* list, const char* str);
55 extern StrList* str_list_join (StrList* a, StrList* b);
56 extern char* str_list_convert (const StrList* list);
57 extern char* str_list_convert_node (const StrList* list);
58
59 extern void str_list_print (const StrList* list);
60 extern void str_list_print_wrap (const StrList* list, int line_length,
61                                  int offset, int indent);
62 extern int str_list_match_any (const StrList* list, const char* str);
63 extern int str_list_match_node (const StrList* list, const char* str);
64 extern StrList* str_list_match (const StrList* list, const char* str);
65
66 extern int str_list_length (const StrList* list);
67
68 #endif /* STRLIST_H_INCLUDED */
69