libreport  2.1.7
A tool to inform users about various problems on the running system
libreport_types.h
1 /*
2  Copyright (C) 2013 ABRT team
3  Copyright (C) 2013 RedHat 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 along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 #ifndef LIBREPORT_TYPES_H_
20 #define LIBREPORT_TYPES_H_
21 
22 #include <glib.h>
23 
24 typedef GHashTable map_string_t;
25 #define new_map_string libreport_new_map_string
26 map_string_t *new_map_string(void);
27 #define free_map_string libreport_free_map_string
28 void free_map_string(map_string_t *ms);
29 #define insert_map_string_item libreport_insert_map_string_item
30 static inline
31 void insert_map_string(map_string_t *ms, char *key, char *value)
32 {
33  g_hash_table_insert(ms, key, value);
34 }
35 #define replace_map_string_item libreport_replace_map_string_item
36 static inline
37 void replace_map_string_item(map_string_t *ms, char *key, char *value)
38 {
39  g_hash_table_replace(ms, key, value);
40 }
41 #define remove_map_string_item libreport_remove_map_string_item
42 static inline
43 void remove_map_string_item(map_string_t *ms, const char *key)
44 {
45  g_hash_table_remove(ms, key);
46 }
47 #define get_map_string_item_or_empty libreport_get_map_string_item_or_empty
48 const char *get_map_string_item_or_empty(map_string_t *ms, const char *key);
49 #define get_map_string_item_or_NULL libreport_get_map_string_item_or_NULL
50 static inline
51 const char *get_map_string_item_or_NULL(map_string_t *ms, const char *key)
52 {
53  return (const char*)g_hash_table_lookup(ms, key);
54 }
55 
56 typedef GHashTableIter map_string_iter_t;
57 #define init_map_string_iter libreport_init_map_string_iter
58 static inline
59 void init_map_string_iter(map_string_iter_t *iter, map_string_t *ms)
60 {
61  g_hash_table_iter_init(iter, ms);
62 }
63 #define next_map_string_iter libreport_next_map_string_iter
64 static inline
65 int next_map_string_iter(map_string_iter_t *iter, const char **key, const char **value)
66 {
67  return g_hash_table_iter_next(iter, (gpointer *)key, (gpointer *)value);
68 }
69 
70 #endif /* LIBREPORT_TYPES_H_ */