diff options
Diffstat (limited to 'libraries/eina/src/lib/eina_binshare.c')
-rw-r--r-- | libraries/eina/src/lib/eina_binshare.c | 182 |
1 files changed, 0 insertions, 182 deletions
diff --git a/libraries/eina/src/lib/eina_binshare.c b/libraries/eina/src/lib/eina_binshare.c deleted file mode 100644 index 01e8046..0000000 --- a/libraries/eina/src/lib/eina_binshare.c +++ /dev/null | |||
@@ -1,182 +0,0 @@ | |||
1 | /* EINA - EFL data type library | ||
2 | * Copyright (C) 2002-2008 Carsten Haitzler, | ||
3 | * Jorge Luis Zapata Muga, | ||
4 | * Cedric Bail, | ||
5 | * Gustavo Sverzut Barbieri | ||
6 | * Tom Hacohen | ||
7 | * | ||
8 | * This library is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU Lesser General Public | ||
10 | * License as published by the Free Software Foundation; either | ||
11 | * version 2.1 of the License, or (at your option) any later version. | ||
12 | * | ||
13 | * This library is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * Lesser General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU Lesser General Public | ||
19 | * License along with this library; | ||
20 | * if not, see <http://www.gnu.org/licenses/>. | ||
21 | |||
22 | */ | ||
23 | |||
24 | #ifdef HAVE_CONFIG_H | ||
25 | # include "config.h" | ||
26 | #endif | ||
27 | |||
28 | #include "eina_config.h" | ||
29 | #include "eina_private.h" | ||
30 | #include "eina_unicode.h" | ||
31 | #include "eina_log.h" | ||
32 | #include "eina_share_common.h" | ||
33 | |||
34 | /* undefs EINA_ARG_NONULL() so NULL checks are not compiled out! */ | ||
35 | #include "eina_safety_checks.h" | ||
36 | #include "eina_binshare.h" | ||
37 | |||
38 | /*============================================================================* | ||
39 | * Local * | ||
40 | *============================================================================*/ | ||
41 | |||
42 | /** | ||
43 | * @cond LOCAL | ||
44 | */ | ||
45 | |||
46 | #ifdef CRITICAL | ||
47 | #undef CRITICAL | ||
48 | #endif | ||
49 | #define CRITICAL(...) EINA_LOG_DOM_CRIT(_eina_share_binshare_log_dom, __VA_ARGS__) | ||
50 | |||
51 | #ifdef ERR | ||
52 | #undef ERR | ||
53 | #endif | ||
54 | #define ERR(...) EINA_LOG_DOM_ERR(_eina_share_binshare_log_dom, __VA_ARGS__) | ||
55 | |||
56 | #ifdef DBG | ||
57 | #undef DBG | ||
58 | #endif | ||
59 | #define DBG(...) EINA_LOG_DOM_DBG(_eina_share_binshare_log_dom, __VA_ARGS__) | ||
60 | |||
61 | static int _eina_share_binshare_log_dom = -1; | ||
62 | |||
63 | /* The actual share */ | ||
64 | static Eina_Share *binshare_share; | ||
65 | static const char EINA_MAGIC_BINSHARE_NODE_STR[] = "Eina Binshare Node"; | ||
66 | |||
67 | /** | ||
68 | * @endcond | ||
69 | */ | ||
70 | |||
71 | /*============================================================================* | ||
72 | * Global * | ||
73 | *============================================================================*/ | ||
74 | |||
75 | /** | ||
76 | * @internal | ||
77 | * @brief Initialize the share_common module. | ||
78 | * | ||
79 | * @return #EINA_TRUE on success, #EINA_FALSE on failure. | ||
80 | * | ||
81 | * This function sets up the share_common module of Eina. It is called by | ||
82 | * eina_init(). | ||
83 | * | ||
84 | * @see eina_init() | ||
85 | */ | ||
86 | EAPI Eina_Bool | ||
87 | eina_binshare_init(void) | ||
88 | { | ||
89 | Eina_Bool ret; | ||
90 | |||
91 | if (_eina_share_binshare_log_dom < 0) | ||
92 | { | ||
93 | _eina_share_binshare_log_dom = eina_log_domain_register | ||
94 | ("eina_binshare", EINA_LOG_COLOR_DEFAULT); | ||
95 | |||
96 | if (_eina_share_binshare_log_dom < 0) | ||
97 | { | ||
98 | EINA_LOG_ERR("Could not register log domain: eina_binshare"); | ||
99 | return EINA_FALSE; | ||
100 | } | ||
101 | } | ||
102 | |||
103 | ret = eina_share_common_init(&binshare_share, | ||
104 | EINA_MAGIC_BINSHARE_NODE, | ||
105 | EINA_MAGIC_BINSHARE_NODE_STR); | ||
106 | |||
107 | if (!ret) | ||
108 | { | ||
109 | eina_log_domain_unregister(_eina_share_binshare_log_dom); | ||
110 | _eina_share_binshare_log_dom = -1; | ||
111 | } | ||
112 | |||
113 | return ret; | ||
114 | } | ||
115 | |||
116 | /** | ||
117 | * @internal | ||
118 | * @brief Shut down the share_common module. | ||
119 | * | ||
120 | * @return #EINA_TRUE on success, #EINA_FALSE on failure. | ||
121 | * | ||
122 | * This function shuts down the share_common module set up by | ||
123 | * eina_share_common_init(). It is called by eina_shutdown(). | ||
124 | * | ||
125 | * @see eina_shutdown() | ||
126 | */ | ||
127 | EAPI Eina_Bool | ||
128 | eina_binshare_shutdown(void) | ||
129 | { | ||
130 | Eina_Bool ret; | ||
131 | ret = eina_share_common_shutdown(&binshare_share); | ||
132 | |||
133 | if (_eina_share_binshare_log_dom > 0) | ||
134 | { | ||
135 | eina_log_domain_unregister(_eina_share_binshare_log_dom); | ||
136 | _eina_share_binshare_log_dom = -1; | ||
137 | } | ||
138 | |||
139 | return ret; | ||
140 | } | ||
141 | |||
142 | |||
143 | /*============================================================================* | ||
144 | * API * | ||
145 | *============================================================================*/ | ||
146 | |||
147 | EAPI void | ||
148 | eina_binshare_del(const void *obj) | ||
149 | { | ||
150 | if (!obj) | ||
151 | return; | ||
152 | |||
153 | if (!eina_share_common_del(binshare_share, obj)) | ||
154 | CRITICAL("EEEK trying to del non-shared binshare %p", obj); | ||
155 | } | ||
156 | |||
157 | EAPI const void * | ||
158 | eina_binshare_add_length(const void *obj, unsigned int olen) | ||
159 | { | ||
160 | return eina_share_common_add_length(binshare_share, | ||
161 | obj, | ||
162 | (olen) * sizeof(char), | ||
163 | 0); | ||
164 | } | ||
165 | |||
166 | EAPI const void * | ||
167 | eina_binshare_ref(const void *obj) | ||
168 | { | ||
169 | return eina_share_common_ref(binshare_share, obj); | ||
170 | } | ||
171 | |||
172 | EAPI int | ||
173 | eina_binshare_length(const void *obj) | ||
174 | { | ||
175 | return eina_share_common_length(binshare_share, obj); | ||
176 | } | ||
177 | |||
178 | EAPI void | ||
179 | eina_binshare_dump(void) | ||
180 | { | ||
181 | eina_share_common_dump(binshare_share, NULL, 0); | ||
182 | } | ||