EAPI int eina_error_init(void);
EAPI int eina_error_shutdown(void);
EAPI int eina_error_register(const char *msg);
+EAPI int eina_error_get(void);
+EAPI void eina_error_set(int err);
EAPI const char * eina_error_msg_get(int error);
EAPI void eina_error_print(Eina_Error_Level level, const char *file,
const char *function, int line, const char *fmt, ...);
/*============================================================================*
* Local *
*============================================================================*/
-static int _curr = 1;
static int _init_count = 0;
static Eina_List *_error_list;
static int _err;
}
}
/*============================================================================*
- * Global *
- *============================================================================*/
-void eina_error_magic_check(unsigned int magic, unsigned int cmp)
-{
- assert(magic == cmp);
-}
-/*============================================================================*
* API *
*============================================================================*/
/**
*/
EAPI int eina_error_init(void)
{
- if (!_init_count)
+ if (!_init_count)
{
char *level;
/* TODO register the eina's basic errors */
*/
EAPI int eina_error_shutdown(void)
{
- if (!_init_count)
- return _init_count;
_init_count--;
if (!_init_count)
{
*/
EAPI int eina_error_register(const char *msg)
{
- char *str;
-
- str = strdup(msg);
- _error_list = eina_list_append(_error_list, str);
-
- return ++_curr;
+ _error_list = eina_list_append(_error_list, strdup(msg));
+
+ return eina_list_count(_error_list);
}
/**
*
*/
EAPI const char * eina_error_msg_get(int error)
{
- return eina_list_nth(_error_list, error);
+ return eina_list_nth(_error_list, error - 1);
}
/**
*
va_end(args);
}
/**
- *
+ *
*/
EAPI void eina_error_log_level_set(Eina_Error_Level level)
{
_error_level = level;
}
+