forked from enlightenment/efl
magic: define and set eina_error if fails.
SVN revision: 67002
This commit is contained in:
parent
398bf0ee45
commit
2046694051
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "eina_config.h"
|
#include "eina_config.h"
|
||||||
#include "eina_types.h"
|
#include "eina_types.h"
|
||||||
|
#include "eina_error.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @page eina_magic_example_01_page
|
* @page eina_magic_example_01_page
|
||||||
|
@ -200,6 +201,13 @@ EAPI Eina_Bool eina_magic_string_static_set(Eina_Magic magic,
|
||||||
*/
|
*/
|
||||||
#define EINA_MAGIC_NONE 0x1234fedc
|
#define EINA_MAGIC_NONE 0x1234fedc
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var EINA_ERROR_MAGIC_FAILED
|
||||||
|
* Error identifier corresponding to magic check failure.
|
||||||
|
*/
|
||||||
|
EAPI extern Eina_Error EINA_ERROR_MAGIC_FAILED;
|
||||||
|
|
||||||
|
|
||||||
#ifdef EINA_MAGIC_DEBUG
|
#ifdef EINA_MAGIC_DEBUG
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -129,6 +129,10 @@ _eina_magic_strings_alloc(void)
|
||||||
* Global *
|
* Global *
|
||||||
*============================================================================*/
|
*============================================================================*/
|
||||||
|
|
||||||
|
EAPI Eina_Error EINA_ERROR_MAGIC_FAILED = 0;
|
||||||
|
|
||||||
|
static const char EINA_ERROR_MAGIC_FAILED_STR[] = "Magic check failed.";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
* @brief Initialize the magic string module.
|
* @brief Initialize the magic string module.
|
||||||
|
@ -150,6 +154,8 @@ eina_magic_string_init(void)
|
||||||
EINA_LOG_ERR("Could not register log domain: eina_magic_string");
|
EINA_LOG_ERR("Could not register log domain: eina_magic_string");
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
EINA_ERROR_MAGIC_FAILED = eina_error_msg_static_register(
|
||||||
|
EINA_ERROR_MAGIC_FAILED_STR);
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -271,6 +277,7 @@ eina_magic_fail(void *d,
|
||||||
const char *fnc,
|
const char *fnc,
|
||||||
int line)
|
int line)
|
||||||
{
|
{
|
||||||
|
eina_error_set(EINA_ERROR_MAGIC_FAILED);
|
||||||
if (!d)
|
if (!d)
|
||||||
eina_log_print(EINA_LOG_DOMAIN_GLOBAL, EINA_LOG_LEVEL_CRITICAL,
|
eina_log_print(EINA_LOG_DOMAIN_GLOBAL, EINA_LOG_LEVEL_CRITICAL,
|
||||||
file, fnc, line,
|
file, fnc, line,
|
||||||
|
|
Loading…
Reference in New Issue