This source file includes following definitions.
- gl_map_create_empty
- gl_map_put
- gl_map_getput
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #ifndef _GL_XMAP_H
19 #define _GL_XMAP_H
20
21 #include "gl_map.h"
22 #include "xalloc.h"
23
24 #ifndef _GL_INLINE_HEADER_BEGIN
25 #error "Please include config.h first."
26 #endif
27 _GL_INLINE_HEADER_BEGIN
28 #ifndef GL_XMAP_INLINE
29 # define GL_XMAP_INLINE _GL_INLINE
30 #endif
31
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37
38
39
40 #if 0
41 extern gl_map_t gl_map_create_empty (gl_map_implementation_t implementation,
42 gl_mapkey_equals_fn equals_fn,
43 gl_mapkey_hashcode_fn hashcode_fn,
44 gl_mapkey_dispose_fn kdispose_fn,
45 gl_mapvalue_dispose_fn vdispose_fn)
46
47 _GL_ATTRIBUTE_RETURNS_NONNULL;
48 extern bool gl_map_put (gl_map_t map, const void *key, const void *value);
49 extern bool gl_map_getput (gl_map_t map, const void *key, const void *value,
50 const void **oldvaluep);
51 #endif
52
53 GL_XMAP_INLINE
54
55 _GL_ATTRIBUTE_RETURNS_NONNULL
56 gl_map_t
57 gl_map_create_empty (gl_map_implementation_t implementation,
58 gl_mapkey_equals_fn equals_fn,
59 gl_mapkey_hashcode_fn hashcode_fn,
60 gl_mapkey_dispose_fn kdispose_fn,
61 gl_mapvalue_dispose_fn vdispose_fn)
62 {
63 gl_map_t result =
64 gl_map_nx_create_empty (implementation, equals_fn, hashcode_fn,
65 kdispose_fn, vdispose_fn);
66 if (result == NULL)
67 xalloc_die ();
68 return result;
69 }
70
71 GL_XMAP_INLINE bool
72 gl_map_put (gl_map_t map, const void *key, const void *value)
73 {
74 int result = gl_map_nx_put (map, key, value);
75 if (result < 0)
76 xalloc_die ();
77 return result;
78 }
79
80 GL_XMAP_INLINE bool
81 gl_map_getput (gl_map_t map, const void *key, const void *value,
82 const void **oldvaluep)
83 {
84 int result = gl_map_nx_getput (map, key, value, oldvaluep);
85 if (result < 0)
86 xalloc_die ();
87 return result;
88 }
89
90 #ifdef __cplusplus
91 }
92 #endif
93
94 _GL_INLINE_HEADER_END
95
96 #endif