X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Flib%2Fmain.c;h=f9998898a878c31ab1f0845fc24e9de5faec9fb3;hb=91d469f4d69d875b6f5ae87c87465f50f63ad87d;hp=0431977589ac31513f32fa27c2ec213a40e08253;hpb=84eea77b2b99d79ded280bbb0ab43ff1ee0f2220;p=framework%2Fuifw%2Fevas.git diff --git a/src/lib/main.c b/src/lib/main.c index 0431977..f999889 100644 --- a/src/lib/main.c +++ b/src/lib/main.c @@ -6,11 +6,7 @@ EAPI Evas_Version *evas_version = &_version; int _evas_alloc_error = 0; static int _evas_debug_init = 0; -static enum { - _EVAS_DEBUG_DEFAULT, - _EVAS_DEBUG_HIDE, - _EVAS_DEBUG_SHOW -} _evas_debug_show = _EVAS_DEBUG_DEFAULT; +static int _evas_debug_show = 0; static int _evas_debug_abort = 0; EAPI Evas_Alloc_Error @@ -49,27 +45,16 @@ evas_mem_calloc(int size) return NULL; } -static void -_evas_debug_init_from_env() -{ - const char *tmp = getenv("EVAS_DEBUG_SHOW"); - if (tmp) - { - int dbgshow = atoi(tmp); - _evas_debug_show = (dbgshow) ? _EVAS_DEBUG_SHOW : _EVAS_DEBUG_HIDE; - } - if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1; - _evas_debug_init = 1; -} - void evas_debug_error(void) { if (!_evas_debug_init) { - _evas_debug_init_from_env(); + if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1; + if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1; + _evas_debug_init = 1; } - if (_evas_debug_show == _EVAS_DEBUG_SHOW) + if (_evas_debug_show) CRIT("Evas Magic Check Failed!!!"); } @@ -78,9 +63,11 @@ evas_debug_input_null(void) { if (!_evas_debug_init) { - _evas_debug_init_from_env(); + if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1; + if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1; + _evas_debug_init = 1; } - if (_evas_debug_show == _EVAS_DEBUG_SHOW) + if (_evas_debug_show) CRIT("Input object pointer is NULL!"); if (_evas_debug_abort) abort(); } @@ -90,10 +77,11 @@ evas_debug_magic_null(void) { if (!_evas_debug_init) { - _evas_debug_init_from_env(); + if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1; + if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1; + _evas_debug_init = 1; } - if ((_evas_debug_show == _EVAS_DEBUG_SHOW) || - (_evas_debug_show == _EVAS_DEBUG_DEFAULT)) + if (_evas_debug_show) CRIT("Input object is zero'ed out (maybe a freed object or zero-filled RAM)!"); if (_evas_debug_abort) abort(); } @@ -103,10 +91,11 @@ evas_debug_magic_wrong(DATA32 expected, DATA32 supplied) { if (!_evas_debug_init) { - _evas_debug_init_from_env(); + if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1; + if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1; + _evas_debug_init = 1; } - if ((_evas_debug_show == _EVAS_DEBUG_SHOW) || - (_evas_debug_show == _EVAS_DEBUG_DEFAULT)) + if (_evas_debug_show) CRIT("Input object is wrong type\n" " Expected: %08x - %s\n" " Supplied: %08x - %s", @@ -120,10 +109,11 @@ evas_debug_generic(const char *str) { if (!_evas_debug_init) { - _evas_debug_init_from_env(); + if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1; + if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1; + _evas_debug_init = 1; } - if ((_evas_debug_show == _EVAS_DEBUG_SHOW) || - (_evas_debug_show == _EVAS_DEBUG_DEFAULT)) + if (_evas_debug_show) CRIT("%s", str); if (_evas_debug_abort) abort(); }