aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eina/src/lib/eina_binshare.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/eina/src/lib/eina_binshare.c')
-rw-r--r--libraries/eina/src/lib/eina_binshare.c69
1 files changed, 62 insertions, 7 deletions
diff --git a/libraries/eina/src/lib/eina_binshare.c b/libraries/eina/src/lib/eina_binshare.c
index 68a82fc..01e8046 100644
--- a/libraries/eina/src/lib/eina_binshare.c
+++ b/libraries/eina/src/lib/eina_binshare.c
@@ -21,9 +21,18 @@
21 21
22 */ 22 */
23 23
24#include "eina_share_common.h" 24#ifdef HAVE_CONFIG_H
25#include "eina_unicode.h" 25# include "config.h"
26#endif
27
28#include "eina_config.h"
26#include "eina_private.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"
27#include "eina_binshare.h" 36#include "eina_binshare.h"
28 37
29/*============================================================================* 38/*============================================================================*
@@ -34,6 +43,23 @@
34 * @cond LOCAL 43 * @cond LOCAL
35 */ 44 */
36 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
61static int _eina_share_binshare_log_dom = -1;
62
37/* The actual share */ 63/* The actual share */
38static Eina_Share *binshare_share; 64static Eina_Share *binshare_share;
39static const char EINA_MAGIC_BINSHARE_NODE_STR[] = "Eina Binshare Node"; 65static const char EINA_MAGIC_BINSHARE_NODE_STR[] = "Eina Binshare Node";
@@ -42,7 +68,6 @@ static const char EINA_MAGIC_BINSHARE_NODE_STR[] = "Eina Binshare Node";
42 * @endcond 68 * @endcond
43 */ 69 */
44 70
45
46/*============================================================================* 71/*============================================================================*
47* Global * 72* Global *
48*============================================================================*/ 73*============================================================================*/
@@ -61,9 +86,31 @@ static const char EINA_MAGIC_BINSHARE_NODE_STR[] = "Eina Binshare Node";
61EAPI Eina_Bool 86EAPI Eina_Bool
62eina_binshare_init(void) 87eina_binshare_init(void)
63{ 88{
64 return eina_share_common_init(&binshare_share, 89 Eina_Bool ret;
65 EINA_MAGIC_BINSHARE_NODE, 90
66 EINA_MAGIC_BINSHARE_NODE_STR); 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;
67} 114}
68 115
69/** 116/**
@@ -82,6 +129,13 @@ eina_binshare_shutdown(void)
82{ 129{
83 Eina_Bool ret; 130 Eina_Bool ret;
84 ret = eina_share_common_shutdown(&binshare_share); 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
85 return ret; 139 return ret;
86} 140}
87 141
@@ -96,7 +150,8 @@ eina_binshare_del(const void *obj)
96 if (!obj) 150 if (!obj)
97 return; 151 return;
98 152
99 eina_share_common_del(binshare_share, obj); 153 if (!eina_share_common_del(binshare_share, obj))
154 CRITICAL("EEEK trying to del non-shared binshare %p", obj);
100} 155}
101 156
102EAPI const void * 157EAPI const void *