/[zanavi_public1]/navit/navit/debug.h
ZANavi

Diff of /navit/navit/debug.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 30 Revision 31
37 */ 37 */
38 38
39#ifndef NAVIT_DEBUG_H 39#ifndef NAVIT_DEBUG_H
40#define NAVIT_DEBUG_H 40#define NAVIT_DEBUG_H
41 41
42
43
44/* 42/*
43 *
44 *
45 *
45 * define some debug stuff here 46 * define some debug stuff here
47 *
48 *
49 *
46 */ 50 */
47// #define NAVIT_FUNC_CALLS_DEBUG_PRINT 1 51// #define NAVIT_FUNC_CALLS_DEBUG_PRINT 1
48// #define NAVIT_SAY_DEBUG_PRINT 1 52// #define NAVIT_SAY_DEBUG_PRINT 1
49// #define NAVIT_MEASURE_TIME_DEBUG 1 53// #define NAVIT_MEASURE_TIME_DEBUG 1
50// #define NAVIT_CALLBACK_DEBUG_PRINT 1 54// #define NAVIT_CALLBACK_DEBUG_PRINT 1
51 55#define NAVIT_ATTR_SAFETY_CHECK 1
56//
57// #define DEBUG_GLIB_MALLOC 1 // <-- does not work yet!
58// #define DEBUG_GLIB_FREE 1
59// #define DEBUG_GLIB_REALLY_FREE 1
60// #define DEBUG_GLIB_MEM_FUNCTIONS 1
61/*
62 *
63 *
64 *
65 *
66 *
67 *
68 *
69 */
52 70
53#ifdef __cplusplus 71#ifdef __cplusplus
54extern "C" 72extern "C"
55{ 73{
56#endif 74#endif
60 78
61#ifdef _MSC_VER 79#ifdef _MSC_VER
62#define __PRETTY_FUNCTION__ __FUNCTION__ 80#define __PRETTY_FUNCTION__ __FUNCTION__
63#endif 81#endif
64 82
83#ifndef HAVE_API_ANDROID
84#define g_free_func g_free
85#endif
86
65extern int debug_level; 87extern int debug_level;
66#define dbg_str2(x) #x 88#define dbg_str2(x) #x
67#define dbg_str1(x) dbg_str2(x) 89#define dbg_str1(x) dbg_str2(x)
68#define dbg_module dbg_str1(MODULE) 90#define dbg_module dbg_str1(MODULE)
69#define dbg(level,...) { if (debug_level >= level) debug_printf(level,dbg_module,strlen(dbg_module),__PRETTY_FUNCTION__, strlen(__PRETTY_FUNCTION__),1,__VA_ARGS__); } 91#define dbg(level,...) { if (debug_level >= level) debug_printf(level,dbg_module,strlen(dbg_module),__PRETTY_FUNCTION__, strlen(__PRETTY_FUNCTION__),1,__VA_ARGS__); }
70#define dbg_assert(expr) ((expr) ? (void) 0 : debug_assert_fail(dbg_module,strlen(dbg_module),__PRETTY_FUNCTION__, strlen(__PRETTY_FUNCTION__),__FILE__,__LINE__,dbg_str1(expr))) 92#define dbg_assert(expr) ((expr) ? (void) 0 : debug_assert_fail(dbg_module,strlen(dbg_module),__PRETTY_FUNCTION__, strlen(__PRETTY_FUNCTION__),__FILE__,__LINE__,dbg_str1(expr)))
71 93
72#ifdef DEBUG_MALLOC 94//#ifdef DEBUG_MALLOC
95// ----------------
73#undef g_new 96//#undef g_new
74#undef g_new0 97//#undef g_new0
75#define g_new(type, size) (type *)debug_malloc(__FILE__,__LINE__,__PRETTY_FUNCTION__,sizeof(type)*(size)) 98//#define g_new(type, size) (type *)debug_malloc(__FILE__,__LINE__,__PRETTY_FUNCTION__,sizeof(type)*(size))
76#define g_new0(type, size) (type *)debug_malloc0(__FILE__,__LINE__,__PRETTY_FUNCTION__,sizeof(type)*(size)) 99//#define g_new0(type, size) (type *)debug_malloc0(__FILE__,__LINE__,__PRETTY_FUNCTION__,sizeof(type)*(size))
77#define g_malloc(size) debug_malloc(__FILE__,__LINE__,__PRETTY_FUNCTION__,(size)) 100//#define g_malloc(size) debug_malloc(__FILE__,__LINE__,__PRETTY_FUNCTION__,(size))
78#define g_malloc0(size) debug_malloc0(__FILE__,__LINE__,__PRETTY_FUNCTION__,(size)) 101//#define g_malloc0(size) debug_malloc0(__FILE__,__LINE__,__PRETTY_FUNCTION__,(size))
79#define g_realloc(ptr,size) debug_realloc(__FILE__,__LINE__,__PRETTY_FUNCTION__,ptr,(size)) 102//#define g_realloc(ptr,size) debug_realloc(__FILE__,__LINE__,__PRETTY_FUNCTION__,ptr,(size))
80#define g_free(ptr) debug_free(__FILE__,__LINE__,__PRETTY_FUNCTION__,ptr) 103//#define g_free(ptr) debug_free(__FILE__,__LINE__,__PRETTY_FUNCTION__,ptr)
81#define g_strdup(ptr) debug_strdup(__FILE__,__LINE__,__PRETTY_FUNCTION__,ptr) 104//#define g_strdup(ptr) debug_strdup(__FILE__,__LINE__,__PRETTY_FUNCTION__,ptr)
82#define g_strdup_printf(fmt...) debug_guard(__FILE__,__LINE__,__PRETTY_FUNCTION__,g_strdup_printf(fmt)) 105//#define g_strdup_printf(fmt...) debug_guard(__FILE__,__LINE__,__PRETTY_FUNCTION__,g_strdup_printf(fmt))
83#define graphics_icon_path(x) debug_guard(__FILE__,__LINE__,__PRETTY_FUNCTION__,graphics_icon_path(x)) 106//#define graphics_icon_path(x) debug_guard(__FILE__,__LINE__,__PRETTY_FUNCTION__,graphics_icon_path(x))
84#define dbg_guard(x) debug_guard(__FILE__,__LINE__,__PRETTY_FUNCTION__,x) 107//#define dbg_guard(x) debug_guard(__FILE__,__LINE__,__PRETTY_FUNCTION__,x)
85#define g_free_func debug_free_func 108//#define g_free_func debug_free_func
109// ----------------
86#else 110//#else
111// ----------------
87#define g_free_func g_free 112//#define g_free_func g_free
88#define dbg_guard(x) x 113#define dbg_guard(x) x
114// ----------------
89#endif 115//#endif
90 116
91/* prototypes */ 117/* prototypes */
92struct attr; 118struct attr;
93struct debug; 119struct debug;
94void debug_init(const char *program_name); 120void debug_init(const char *program_name);

Legend:
Removed from v.30  
changed lines
  Added in v.31

   
Visit the ZANavi Wiki