summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2013-03-26 08:43:16 +0000
committerStefan Schmidt <s.schmidt@samsung.com>2013-03-26 09:33:59 +0000
commit394fa35356f3884b447a6ddf36f34a21b903c65c (patch)
tree068878c29af4ec878b048dcb729444e61199557c
parent948d7e3743ece5e4abbdd522771880f3c33e50e6 (diff)
eeze: Make eeze sensor log domain private and use different ones for the modules
The main eeze sensor log domain was EAPI as it was used in the modules as well. (Gives some nice runtime error when loading the shared object). Switch to different domains for the module and make the main domain private. Spotted by zmike.
-rw-r--r--src/lib/eeze/eeze_main.c2
-rw-r--r--src/modules/eeze/sensor/fake/fake.c18
-rw-r--r--src/modules/eeze/sensor/tizen/tizen.c18
3 files changed, 37 insertions, 1 deletions
diff --git a/src/lib/eeze/eeze_main.c b/src/lib/eeze/eeze_main.c
index 1b2bfc2571..e2b878b20b 100644
--- a/src/lib/eeze/eeze_main.c
+++ b/src/lib/eeze/eeze_main.c
@@ -14,7 +14,7 @@ _udev *udev;
14 14
15int _eeze_udev_log_dom = -1; 15int _eeze_udev_log_dom = -1;
16int _eeze_net_log_dom = -1; 16int _eeze_net_log_dom = -1;
17EAPI int _eeze_sensor_log_dom = -1; 17int _eeze_sensor_log_dom = -1;
18int _eeze_init_count = 0; 18int _eeze_init_count = 0;
19 19
20static Eeze_Version _version = { VMAJ, VMIN, VMIC, VREV }; 20static Eeze_Version _version = { VMAJ, VMIN, VMIC, VREV };
diff --git a/src/modules/eeze/sensor/fake/fake.c b/src/modules/eeze/sensor/fake/fake.c
index 85689fd29a..2544afafb0 100644
--- a/src/modules/eeze/sensor/fake/fake.c
+++ b/src/modules/eeze/sensor/fake/fake.c
@@ -15,6 +15,13 @@
15 * fixed values for the data, but provides the correct timestamp value. 15 * fixed values for the data, but provides the correct timestamp value.
16 */ 16 */
17 17
18static int _eeze_sensor_fake_log_dom = -1;
19
20#ifdef ERR
21#undef ERR
22#endif
23#define ERR(...) EINA_LOG_DOM_ERR(_eeze_sensor_fake_log_dom, __VA_ARGS__)
24
18Eeze_Sensor_Module *esensor_module; 25Eeze_Sensor_Module *esensor_module;
19 26
20Eina_Bool 27Eina_Bool
@@ -147,6 +154,14 @@ fake_async_read(Eeze_Sensor_Type sensor_type, void *user_data EINA_UNUSED)
147Eina_Bool 154Eina_Bool
148sensor_fake_init(void) 155sensor_fake_init(void)
149{ 156{
157
158 _eeze_sensor_fake_log_dom = eina_log_domain_register("eeze_sensor_fake", EINA_COLOR_BLUE);
159 if (_eeze_sensor_fake_log_dom < 0)
160 {
161 EINA_LOG_ERR("Could not register 'eeze_sensor_fake' log domain.");
162 return EINA_FALSE;
163 }
164
150 /* Check to avoid multi-init */ 165 /* Check to avoid multi-init */
151 if (esensor_module) return EINA_FALSE; 166 if (esensor_module) return EINA_FALSE;
152 167
@@ -184,6 +199,9 @@ sensor_fake_shutdown(void)
184 199
185 free(esensor_module); 200 free(esensor_module);
186 esensor_module = NULL; 201 esensor_module = NULL;
202
203 eina_log_domain_unregister(_eeze_sensor_fake_log_dom);
204 _eeze_sensor_fake_log_dom = -1;
187} 205}
188 206
189EINA_MODULE_INIT(sensor_fake_init); 207EINA_MODULE_INIT(sensor_fake_init);
diff --git a/src/modules/eeze/sensor/tizen/tizen.c b/src/modules/eeze/sensor/tizen/tizen.c
index 55db220a1b..b22bf63067 100644
--- a/src/modules/eeze/sensor/tizen/tizen.c
+++ b/src/modules/eeze/sensor/tizen/tizen.c
@@ -13,6 +13,13 @@
13#include <Eeze_Sensor.h> 13#include <Eeze_Sensor.h>
14#include "eeze_sensor_private.h" 14#include "eeze_sensor_private.h"
15 15
16static int _eeze_sensor_tizen_log_dom = -1;
17
18#ifdef ERR
19#undef ERR
20#endif
21#define ERR(...) EINA_LOG_DOM_ERR(_eeze_sensor_tizen_log_dom, __VA_ARGS__)
22
16Eeze_Sensor_Module *esensor_module; 23Eeze_Sensor_Module *esensor_module;
17/* Tizen sensor handle */ 24/* Tizen sensor handle */
18sensor_h sensor_handle; 25sensor_h sensor_handle;
@@ -826,6 +833,14 @@ eeze_sensor_tizen_init(void)
826Eina_Bool 833Eina_Bool
827sensor_tizen_init(void) 834sensor_tizen_init(void)
828{ 835{
836
837 _eeze_sensor_tizen_log_dom = eina_log_domain_register("eeze_sensor_tizen", EINA_COLOR_BLUE);
838 if (_eeze_sensor_tizen_log_dom < 0)
839 {
840 EINA_LOG_ERR("Could not register 'eeze_sensor_tizen' log domain.");
841 return EINA_FALSE;
842 }
843
829 /* Check to avoid multi-init */ 844 /* Check to avoid multi-init */
830 if (esensor_module) return EINA_FALSE; 845 if (esensor_module) return EINA_FALSE;
831 846
@@ -862,6 +877,9 @@ sensor_tizen_shutdown(void)
862 877
863 free(esensor_module); 878 free(esensor_module);
864 esensor_module = NULL; 879 esensor_module = NULL;
880
881 eina_log_domain_unregister(_eeze_sensor_tizen_log_dom);
882 _eeze_sensor_tizen_log_dom = -1;
865} 883}
866 884
867EINA_MODULE_INIT(sensor_tizen_init); 885EINA_MODULE_INIT(sensor_tizen_init);