summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlavio Ceolin <flavio.ceolin@gmail.com>2014-07-12 15:38:58 -0300
committerFlavio Ceolin <flavio.ceolin@gmail.com>2014-08-14 23:33:18 -0300
commit727e30e766ac235e18df4ca9c34dac1f295701fe (patch)
treec063816f79ea760537c4953f1a9755cd21a29606 /src
parentf7c1071f17350e90b6da45d4cf6455413c3c6483 (diff)
emix: Changing emix_init to return eina_bool
This function should return a value to be possible check if it failed or not.
Diffstat (limited to 'src')
-rw-r--r--src/lib/emix.c15
-rw-r--r--src/lib/emix.h2
-rw-r--r--src/module/e_mod_config.c2
-rw-r--r--src/module/e_mod_main.c2
4 files changed, 11 insertions, 10 deletions
diff --git a/src/lib/emix.c b/src/lib/emix.c
index 2264a49..f03b2f0 100644
--- a/src/lib/emix.c
+++ b/src/lib/emix.c
@@ -140,13 +140,16 @@ _backend_get_cb(Eina_Module *module, void *data EINA_UNUSED)
140 return EINA_FALSE; 140 return EINA_FALSE;
141} 141}
142 142
143void 143Eina_Bool
144emix_init(void) 144emix_init(void)
145{ 145{
146 if (_init_count > 0)
147 goto end;
148
146 if (!eina_init()) 149 if (!eina_init())
147 { 150 {
148 fprintf(stderr, "Could not init eina\n"); 151 fprintf(stderr, "Could not init eina\n");
149 return; 152 return EINA_FALSE;
150 } 153 }
151 154
152 _log_domain = eina_log_domain_register("emix", NULL); 155 _log_domain = eina_log_domain_register("emix", NULL);
@@ -162,14 +165,11 @@ emix_init(void)
162 goto err_ecore; 165 goto err_ecore;
163 } 166 }
164 167
165 if (_init_count > 0)
166 goto end;
167
168 ctx = calloc(1, sizeof(Context)); 168 ctx = calloc(1, sizeof(Context));
169 if (!ctx) 169 if (!ctx)
170 { 170 {
171 ERR("Could not create Epulse Context"); 171 ERR("Could not create Epulse Context");
172 return; 172 goto err_ecore;
173 } 173 }
174 174
175 ctx->backends = eina_module_list_get(ctx->backends, 175 ctx->backends = eina_module_list_get(ctx->backends,
@@ -195,7 +195,7 @@ emix_init(void)
195 195
196 end: 196 end:
197 _init_count++; 197 _init_count++;
198 return; 198 return EINA_TRUE;
199 err: 199 err:
200 free(ctx); 200 free(ctx);
201 ctx = NULL; 201 ctx = NULL;
@@ -204,6 +204,7 @@ emix_init(void)
204 _log_domain = -1; 204 _log_domain = -1;
205 err_log: 205 err_log:
206 eina_shutdown(); 206 eina_shutdown();
207 return EINA_FALSE;
207} 208}
208 209
209void 210void
diff --git a/src/lib/emix.h b/src/lib/emix.h
index 2a60fd3..e0a5b0c 100644
--- a/src/lib/emix.h
+++ b/src/lib/emix.h
@@ -96,7 +96,7 @@ typedef struct _Emix_Backend {
96} Emix_Backend; 96} Emix_Backend;
97 97
98 98
99EAPI void emix_init(void); 99EAPI Eina_Bool emix_init(void);
100EAPI void emix_shutdown(void); 100EAPI void emix_shutdown(void);
101EAPI const Eina_List* emix_backends_available(void); 101EAPI const Eina_List* emix_backends_available(void);
102EAPI Eina_Bool emix_backend_set(const char *backend); 102EAPI Eina_Bool emix_backend_set(const char *backend);
diff --git a/src/module/e_mod_config.c b/src/module/e_mod_config.c
index e5dde08..3855fff 100644
--- a/src/module/e_mod_config.c
+++ b/src/module/e_mod_config.c
@@ -58,7 +58,7 @@ emix_config_init(void)
58{ 58{
59 const Eina_List *l; 59 const Eina_List *l;
60 60
61 emix_init(); 61 EINA_SAFETY_ON_FALSE_RETURN(emix_init());
62 cd = _emix_config_dd_new(); 62 cd = _emix_config_dd_new();
63 _config = e_config_domain_load("module.emix", cd); 63 _config = e_config_domain_load("module.emix", cd);
64 if (!_config) 64 if (!_config)
diff --git a/src/module/e_mod_main.c b/src/module/e_mod_main.c
index 4f11a3c..9cf1ca9 100644
--- a/src/module/e_mod_main.c
+++ b/src/module/e_mod_main.c
@@ -680,7 +680,7 @@ e_modapi_init(E_Module *m)
680 char buf[4096]; 680 char buf[4096];
681 const char *backend; 681 const char *backend;
682 682
683 emix_init(); 683 EINA_SAFETY_ON_FALSE_RETURN_VAL(emix_init(), NULL);
684 emix_config_init(); 684 emix_config_init();
685 685
686 backend = emix_config_backend_get(); 686 backend = emix_config_backend_get();