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.
This commit is contained in:
Stefan Schmidt 2013-03-26 08:43:16 +00:00
parent 948d7e3743
commit 394fa35356
3 changed files with 37 additions and 1 deletions

View File

@ -14,7 +14,7 @@ _udev *udev;
int _eeze_udev_log_dom = -1;
int _eeze_net_log_dom = -1;
EAPI int _eeze_sensor_log_dom = -1;
int _eeze_sensor_log_dom = -1;
int _eeze_init_count = 0;
static Eeze_Version _version = { VMAJ, VMIN, VMIC, VREV };

View File

@ -15,6 +15,13 @@
* fixed values for the data, but provides the correct timestamp value.
*/
static int _eeze_sensor_fake_log_dom = -1;
#ifdef ERR
#undef ERR
#endif
#define ERR(...) EINA_LOG_DOM_ERR(_eeze_sensor_fake_log_dom, __VA_ARGS__)
Eeze_Sensor_Module *esensor_module;
Eina_Bool
@ -147,6 +154,14 @@ fake_async_read(Eeze_Sensor_Type sensor_type, void *user_data EINA_UNUSED)
Eina_Bool
sensor_fake_init(void)
{
_eeze_sensor_fake_log_dom = eina_log_domain_register("eeze_sensor_fake", EINA_COLOR_BLUE);
if (_eeze_sensor_fake_log_dom < 0)
{
EINA_LOG_ERR("Could not register 'eeze_sensor_fake' log domain.");
return EINA_FALSE;
}
/* Check to avoid multi-init */
if (esensor_module) return EINA_FALSE;
@ -184,6 +199,9 @@ sensor_fake_shutdown(void)
free(esensor_module);
esensor_module = NULL;
eina_log_domain_unregister(_eeze_sensor_fake_log_dom);
_eeze_sensor_fake_log_dom = -1;
}
EINA_MODULE_INIT(sensor_fake_init);

View File

@ -13,6 +13,13 @@
#include <Eeze_Sensor.h>
#include "eeze_sensor_private.h"
static int _eeze_sensor_tizen_log_dom = -1;
#ifdef ERR
#undef ERR
#endif
#define ERR(...) EINA_LOG_DOM_ERR(_eeze_sensor_tizen_log_dom, __VA_ARGS__)
Eeze_Sensor_Module *esensor_module;
/* Tizen sensor handle */
sensor_h sensor_handle;
@ -826,6 +833,14 @@ eeze_sensor_tizen_init(void)
Eina_Bool
sensor_tizen_init(void)
{
_eeze_sensor_tizen_log_dom = eina_log_domain_register("eeze_sensor_tizen", EINA_COLOR_BLUE);
if (_eeze_sensor_tizen_log_dom < 0)
{
EINA_LOG_ERR("Could not register 'eeze_sensor_tizen' log domain.");
return EINA_FALSE;
}
/* Check to avoid multi-init */
if (esensor_module) return EINA_FALSE;
@ -862,6 +877,9 @@ sensor_tizen_shutdown(void)
free(esensor_module);
esensor_module = NULL;
eina_log_domain_unregister(_eeze_sensor_tizen_log_dom);
_eeze_sensor_tizen_log_dom = -1;
}
EINA_MODULE_INIT(sensor_tizen_init);