summaryrefslogtreecommitdiff
path: root/legacy/evas/src/lib/main.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2003-05-19 05:36:12 +0000
committerCarsten Haitzler <raster@rasterman.com>2003-05-19 05:36:12 +0000
commit72c06b259bf40ac0993362411168b8319d015300 (patch)
tree69901694b60b48b3f27b445634e24101b7055c8b /legacy/evas/src/lib/main.c
parent9e87031686330ef29245a9681a9ea1991bf77f02 (diff)
evas now uses
EVAS_DEBUG_SHOW EVAS_DEBUG_ABORT environment variables to disctate if: 1. it displays any error output if it encorunters wrong object types, NULLs etc. 2. if it should call abort() on such an error so it can be easily caught with gdb as a segv. if these enironment variables exists it will do both.. if they dont it will not perform the appropriate action. (so now by default evas remains quiet and marches on) SVN revision: 6915
Diffstat (limited to '')
-rw-r--r--legacy/evas/src/lib/main.c56
1 files changed, 44 insertions, 12 deletions
diff --git a/legacy/evas/src/lib/main.c b/legacy/evas/src/lib/main.c
index 922ec49ebe..c7619b9bc0 100644
--- a/legacy/evas/src/lib/main.c
+++ b/legacy/evas/src/lib/main.c
@@ -3,6 +3,9 @@
3#include "Evas.h" 3#include "Evas.h"
4 4
5int _evas_alloc_error = 0; 5int _evas_alloc_error = 0;
6static int _evas_debug_init = 0;
7static int _evas_debug_show = 0;
8static int _evas_debug_abort = 0;
6 9
7/** 10/**
8 * Return if any allocation errors have occured during the prior function 11 * Return if any allocation errors have occured during the prior function
@@ -92,33 +95,62 @@ evas_mem_calloc(int size)
92void 95void
93evas_debug_error(void) 96evas_debug_error(void)
94{ 97{
95 fprintf(stderr, 98 if (!_evas_debug_init)
96 "*** EVAS ERROR: Evas Magic Check Failed!!!\n"); 99 {
100 if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1;
101 if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1;
102 _evas_debug_init = 1;
103 }
104 if (_evas_debug_show)
105 fprintf(stderr,
106 "*** EVAS ERROR: Evas Magic Check Failed!!!\n");
97} 107}
98 108
99void 109void
100evas_debug_input_null(void) 110evas_debug_input_null(void)
101{ 111{
102 fprintf(stderr, 112 if (!_evas_debug_init)
103 " Input object pointer is NULL!\n"); 113 {
114 if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1;
115 if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1;
116 _evas_debug_init = 1;
117 }
118 if (_evas_debug_show)
119 fprintf(stderr,
120 " Input object pointer is NULL!\n");
104} 121}
105 122
106void 123void
107evas_debug_magic_null(void) 124evas_debug_magic_null(void)
108{ 125{
109 fprintf(stderr, 126 if (!_evas_debug_init)
110 " Input object is zero'ed out (maybe a freed object or zero-filled RAM)!\n"); 127 {
128 if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1;
129 if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1;
130 _evas_debug_init = 1;
131 }
132 if (_evas_debug_show)
133 fprintf(stderr,
134 " Input object is zero'ed out (maybe a freed object or zero-filled RAM)!\n");
111} 135}
112 136
113void 137void
114evas_debug_magic_wrong(DATA32 expected, DATA32 supplied) 138evas_debug_magic_wrong(DATA32 expected, DATA32 supplied)
115{ 139{
116 fprintf(stderr, 140 if (!_evas_debug_init)
117 " Input object is wrong type\n" 141 {
118 " Expected: %08x - %s\n" 142 if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1;
119 " Supplied: %08x - %s\n", 143 if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1;
120 expected, evas_debug_magic_string_get(expected), 144 _evas_debug_init = 1;
121 supplied, evas_debug_magic_string_get(supplied)); 145 }
146 if (_evas_debug_show)
147 fprintf(stderr,
148 " Input object is wrong type\n"
149 " Expected: %08x - %s\n"
150 " Supplied: %08x - %s\n",
151 expected, evas_debug_magic_string_get(expected),
152 supplied, evas_debug_magic_string_get(supplied));
153 if (_evas_debug_abort) abort();
122} 154}
123 155
124char * 156char *