5db8460275fe0e43e032a972f665186dcd9dfd52
[profile/ivi/eina.git] / src / lib / eina_main.c
1 /* EINA - EFL data type library
2  * Copyright (C) 2008 Cedric Bail
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library;
16  * if not, see <http://www.gnu.org/licenses/>.
17  */
18
19 #ifdef HAVE_CONFIG_H
20 # include "config.h"
21 #endif
22
23 #include "Eina.h"
24
25 /*============================================================================*
26  *                                 Global                                     *
27  *============================================================================*/
28
29 /*============================================================================*
30  *                                   API                                      *
31  *============================================================================*/
32
33 static int _eina_main_count = 0;
34
35 EAPI int
36 eina_init(void)
37 {
38    if (_eina_main_count) goto finish_init;
39
40    eina_error_init();
41    eina_hash_init();
42    eina_stringshare_init();
43    eina_list_init();
44    eina_array_init();
45    eina_counter_init();
46    eina_benchmark_init();
47    eina_magic_string_init();
48
49  finish_init:
50    return ++_eina_main_count;
51 }
52
53 EAPI int
54 eina_shutdown(void)
55 {
56    if (_eina_main_count != 1) goto finish_shutdown;
57
58    eina_magic_string_shutdown();
59    eina_benchmark_shutdown();
60    eina_counter_shutdown();
61    eina_array_shutdown();
62    eina_list_shutdown();
63    eina_stringshare_shutdown();
64    eina_hash_shutdown();
65    eina_error_shutdown();
66
67  finish_shutdown:
68    return --_eina_main_count;
69 }
70