forked from enlightenment/efl
Fix init error handling of array, benchmark, counter,main,
rectangle and stringshare modules. Patch by Andre Dieb, modified by me (formatting and fix for the Windows code in eina_counter) SVN revision: 40915
This commit is contained in:
parent
46836c875f
commit
33cfc873ec
|
@ -9,4 +9,4 @@ Peter "pfritz" Wehrfritz <peter.wehrfritz@web.de>
|
|||
Arnaud de Turckheim "quarium" <quarium@gmail.com>
|
||||
Alexandre "diaxen" Becoulet <diaxen@free.fr>
|
||||
Albin Tonnerre <albin.tonnerre@gmail.com>
|
||||
Andre Dieb <andre.martins@ee.ufcg.edu.br>
|
||||
Andre Dieb <andre.dieb@gmail.com>
|
||||
|
|
|
@ -148,6 +148,7 @@
|
|||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "eina_types.h"
|
||||
#include "eina_error.h"
|
||||
|
@ -360,8 +361,18 @@ eina_array_init(void)
|
|||
{
|
||||
if (!_eina_array_init_count)
|
||||
{
|
||||
eina_error_init();
|
||||
eina_magic_string_init();
|
||||
if (!eina_error_init())
|
||||
{
|
||||
fprintf(stderr, "Could not initialize eina error module.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!eina_magic_string_init())
|
||||
{
|
||||
EINA_ERROR_PERR("ERROR: Could not initialize eina magic string module.\n");
|
||||
eina_error_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
||||
eina_magic_string_set(EINA_MAGIC_ITERATOR,
|
||||
"Eina Iterator");
|
||||
|
|
|
@ -145,11 +145,29 @@ eina_benchmark_init(void)
|
|||
|
||||
if (_eina_benchmark_count > 1) return _eina_benchmark_count;
|
||||
|
||||
eina_error_init();
|
||||
eina_array_init();
|
||||
eina_counter_init();
|
||||
if (!eina_error_init())
|
||||
{
|
||||
fprintf(stderr, "Could not initialize eina error module.\n");
|
||||
return 0;
|
||||
}
|
||||
if (!eina_array_init())
|
||||
{
|
||||
EINA_ERROR_PERR("Could not initialize eina array module.\n");
|
||||
goto array_init_error;
|
||||
}
|
||||
if (!eina_counter_init())
|
||||
{
|
||||
EINA_ERROR_PERR("Could not initialize eina counter module.\n");
|
||||
goto counter_init_error;
|
||||
}
|
||||
|
||||
return _eina_benchmark_count;
|
||||
|
||||
counter_init_error:
|
||||
eina_array_shutdown();
|
||||
array_init_error:
|
||||
eina_error_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -252,12 +252,16 @@ eina_counter_init(void)
|
|||
|
||||
if (_eina_counter_init_count == 1)
|
||||
{
|
||||
eina_error_init();
|
||||
if (!eina_error_init())
|
||||
{
|
||||
fprintf(stderr, "Could not initialize eina error module.\n");
|
||||
return 0;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
if (!QueryPerformanceFrequency(&_eina_counter_frequency))
|
||||
{
|
||||
EINA_COUNTER_ERROR_WINDOWS = eina_error_msg_register("Change your OS, you moron !");
|
||||
_eina_counter_init_count--;
|
||||
eina_error_shutdown();
|
||||
return 0;
|
||||
}
|
||||
#endif /* _WIN2 */
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
* if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
@ -47,18 +49,72 @@ eina_init(void)
|
|||
{
|
||||
if (_eina_main_count) goto finish_init;
|
||||
|
||||
eina_error_init();
|
||||
eina_hash_init();
|
||||
eina_stringshare_init();
|
||||
eina_list_init();
|
||||
eina_array_init();
|
||||
eina_counter_init();
|
||||
eina_benchmark_init();
|
||||
eina_magic_string_init();
|
||||
eina_rectangle_init();
|
||||
if (!eina_error_init())
|
||||
{
|
||||
fprintf(stderr, "Could not initialize eina error module.\n");
|
||||
return 0;
|
||||
}
|
||||
if (!eina_hash_init())
|
||||
{
|
||||
EINA_ERROR_PERR("Could not initialize eina hash module.\n");
|
||||
goto hash_init_error;
|
||||
}
|
||||
if (!eina_stringshare_init())
|
||||
{
|
||||
EINA_ERROR_PERR("Could not initialize eina stringshare module.\n");
|
||||
goto stringshare_init_error;
|
||||
}
|
||||
if (!eina_list_init())
|
||||
{
|
||||
EINA_ERROR_PERR("Could not initialize eina list module.\n");
|
||||
goto list_init_error;
|
||||
}
|
||||
if (!eina_array_init())
|
||||
{
|
||||
EINA_ERROR_PERR("Could not initialize eina array module.\n");
|
||||
goto array_init_error;
|
||||
}
|
||||
if (!eina_counter_init())
|
||||
{
|
||||
EINA_ERROR_PERR("Could not initialize eina counter module.\n");
|
||||
goto counter_init_error;
|
||||
}
|
||||
if (!eina_benchmark_init())
|
||||
{
|
||||
EINA_ERROR_PERR("Could not initialize eina benchmark module.\n");
|
||||
goto benchmark_init_error;
|
||||
}
|
||||
if (!eina_magic_string_init())
|
||||
{
|
||||
EINA_ERROR_PERR("Could not initialize eina magic string module.\n");
|
||||
goto magic_string_init_error;
|
||||
}
|
||||
if (!eina_rectangle_init())
|
||||
{
|
||||
EINA_ERROR_PERR("Could not initialize eina rectangle module.\n");
|
||||
goto rectangle_init_error;
|
||||
}
|
||||
|
||||
finish_init:
|
||||
return ++_eina_main_count;
|
||||
|
||||
rectangle_init_error:
|
||||
eina_magic_string_shutdown();
|
||||
magic_string_init_error:
|
||||
eina_benchmark_shutdown();
|
||||
benchmark_init_error:
|
||||
eina_counter_shutdown();
|
||||
counter_init_error:
|
||||
eina_array_shutdown();
|
||||
array_init_error:
|
||||
eina_list_shutdown();
|
||||
list_init_error:
|
||||
eina_stringshare_shutdown();
|
||||
stringshare_init_error:
|
||||
eina_hash_shutdown();
|
||||
hash_init_error:
|
||||
eina_error_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "eina_rectangle.h"
|
||||
|
@ -353,8 +354,16 @@ eina_rectangle_init(void)
|
|||
|
||||
if (_eina_rectangle_init_count > 1) return _eina_rectangle_init_count;
|
||||
|
||||
eina_error_init();
|
||||
eina_mempool_init();
|
||||
if (!eina_error_init())
|
||||
{
|
||||
fprintf(stderr, "Could not initialize eina error module.\n");
|
||||
return 0;
|
||||
}
|
||||
if (!eina_mempool_init())
|
||||
{
|
||||
EINA_ERROR_PERR("Could not initialize eina mempool module.\n");
|
||||
goto mempool_init_error;
|
||||
}
|
||||
|
||||
#ifdef EINA_DEFAULT_MEMPOOL
|
||||
choice = "pass_through";
|
||||
|
@ -368,10 +377,17 @@ eina_rectangle_init(void)
|
|||
if (!_eina_rectangle_mp)
|
||||
{
|
||||
EINA_ERROR_PERR("ERROR: Mempool for rectangle cannot be allocated in list init.\n");
|
||||
abort();
|
||||
goto init_error;
|
||||
}
|
||||
|
||||
return _eina_rectangle_init_count;
|
||||
|
||||
init_error:
|
||||
eina_mempool_shutdown();
|
||||
mempool_init_error:
|
||||
eina_error_shutdown();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
|
|
|
@ -829,8 +829,18 @@ eina_stringshare_init(void)
|
|||
if (!share)
|
||||
return 0;
|
||||
|
||||
eina_error_init();
|
||||
eina_magic_string_init();
|
||||
if (!eina_error_init())
|
||||
{
|
||||
fprintf(stderr, "Could not initialize eina error module.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!eina_magic_string_init())
|
||||
{
|
||||
EINA_ERROR_PERR("ERROR: Could not initialize eina magic string module.\n");
|
||||
eina_error_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
||||
eina_magic_string_set(EINA_MAGIC_STRINGSHARE,
|
||||
"Eina Stringshare");
|
||||
|
|
Loading…
Reference in New Issue