summaryrefslogtreecommitdiff
path: root/src/lib/elput/elput.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/elput/elput.c')
-rw-r--r--src/lib/elput/elput.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/lib/elput/elput.c b/src/lib/elput/elput.c
new file mode 100644
index 0000000000..1b5613fc3a
--- /dev/null
+++ b/src/lib/elput/elput.c
@@ -0,0 +1,55 @@
1#include "elput_private.h"
2
3/* local variables */
4static int _elput_init_count = 0;
5
6/* external variables */
7int _elput_log_dom = -1;
8
9EAPI int
10elput_init(void)
11{
12 if (++_elput_init_count != 1) return _elput_init_count;
13
14 if (!eina_init()) goto eina_err;
15 if (!ecore_init()) goto ecore_err;
16 if (!ecore_event_init()) goto ecore_event_err;
17 if (!eeze_init()) goto eeze_err;
18
19 _elput_log_dom = eina_log_domain_register("elput", ELPUT_DEFAULT_LOG_COLOR);
20 if (!_elput_log_dom)
21 {
22 EINA_LOG_ERR("Could not create logging domain for Elput");
23 goto log_err;
24 }
25
26 return _elput_init_count;
27
28log_err:
29 eeze_shutdown();
30eeze_err:
31 ecore_event_shutdown();
32ecore_event_err:
33 ecore_shutdown();
34ecore_err:
35 eina_shutdown();
36eina_err:
37 return --_elput_init_count;
38}
39
40EAPI int
41elput_shutdown(void)
42{
43 if (_elput_init_count < 1) return 0;
44 if (--_elput_init_count != 0) return _elput_init_count;
45
46 eina_log_domain_unregister(_elput_log_dom);
47 _elput_log_dom = -1;
48
49 eeze_shutdown();
50 ecore_event_shutdown();
51 ecore_shutdown();
52 eina_shutdown();
53
54 return _elput_init_count;
55}