- Slight reorganisation of functions that should be disabled

Original commit message from CVS:
- Slight reorganisation of functions that should be disabled
- make sure _gst_debug_register_funcptr is #ifdeffed out when DEBUGGING is
disabled.

This should fix 106047. Please retest.
This commit is contained in:
Wim Taymans 2003-03-14 18:31:47 +00:00
parent 981f6185c5
commit 0b3a5d14db
2 changed files with 18 additions and 25 deletions

View file

@ -484,13 +484,9 @@ gst_default_error_handler (gchar *file, gchar *function,
} }
/***** DEBUG system *****/ /***** DEBUG system *****/
#ifdef GST_DEBUG_ENABLED #ifdef GST_DEBUG_ENABLED
#ifdef GST_DEBUG_ENABLED
GHashTable *__gst_function_pointers = NULL; GHashTable *__gst_function_pointers = NULL;
/* FIXME make this thread specific */
/* static GSList *stack_trace = NULL; */
gchar *_gst_debug_nameof_funcptr (void *ptr) G_GNUC_NO_INSTRUMENT; gchar *_gst_debug_nameof_funcptr (void *ptr) G_GNUC_NO_INSTRUMENT;
@ -507,12 +503,25 @@ _gst_debug_nameof_funcptr (void *ptr)
return g_strdup_printf("%p",ptr); return g_strdup_printf("%p",ptr);
} }
return NULL; return NULL;
#endif
} }
#endif
void *
_gst_debug_register_funcptr (void *ptr, gchar *ptrname)
{
if (!__gst_function_pointers)
__gst_function_pointers = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!g_hash_table_lookup (__gst_function_pointers, ptr))
g_hash_table_insert (__gst_function_pointers, ptr, ptrname);
return ptr;
}
#endif /* GST_DEBUG_ENABLED */
#ifdef GST_ENABLE_FUNC_INSTRUMENTATION #ifdef GST_ENABLE_FUNC_INSTRUMENTATION
/* FIXME make this thread specific */
static GSList *stack_trace = NULL;
void __cyg_profile_func_enter(void *this_fn,void *call_site) G_GNUC_NO_INSTRUMENT; void __cyg_profile_func_enter(void *this_fn,void *call_site) G_GNUC_NO_INSTRUMENT;
void __cyg_profile_func_enter(void *this_fn,void *call_site) void __cyg_profile_func_enter(void *this_fn,void *call_site)
{ {
@ -564,13 +573,3 @@ gst_debug_print_stack_trace (void)
#endif /* GST_ENABLE_FUNC_INTSTRUMENTATION */ #endif /* GST_ENABLE_FUNC_INTSTRUMENTATION */
void *
_gst_debug_register_funcptr (void *ptr, gchar *ptrname)
{
if (!__gst_function_pointers)
__gst_function_pointers = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!g_hash_table_lookup (__gst_function_pointers, ptr))
g_hash_table_insert (__gst_function_pointers, ptr, ptrname);
return ptr;
}

View file

@ -352,8 +352,6 @@ void gst_default_info_handler (gint category,gboolean incore,
gint line,const gchar *debug_string, gint line,const gchar *debug_string,
void *element,gchar *string); void *element,gchar *string);
void * _gst_debug_register_funcptr (void *ptr, gchar *ptrname);
extern GstInfoHandler _gst_info_handler; extern GstInfoHandler _gst_info_handler;
extern guint32 _gst_info_categories; extern guint32 _gst_info_categories;
@ -458,13 +456,11 @@ extern GstErrorHandler _gst_error_handler;
#endif #endif
/********** function pointer stuff **********/ /********** function pointer stuff **********/
extern GHashTable *__gst_function_pointers;
#if GST_DEBUG_ENABLED #if GST_DEBUG_ENABLED
void* _gst_debug_register_funcptr (void *ptr, gchar *ptrname);
gchar* _gst_debug_nameof_funcptr (void *ptr);
#define GST_DEBUG_FUNCPTR(ptr) _gst_debug_register_funcptr((void *)(ptr), #ptr) #define GST_DEBUG_FUNCPTR(ptr) _gst_debug_register_funcptr((void *)(ptr), #ptr)
#define GST_DEBUG_FUNCPTR_NAME(ptr) _gst_debug_nameof_funcptr((void *)ptr) #define GST_DEBUG_FUNCPTR_NAME(ptr) _gst_debug_nameof_funcptr((void *)ptr)
#else #else
@ -472,8 +468,6 @@ extern GHashTable *__gst_function_pointers;
#define GST_DEBUG_FUNCPTR_NAME(ptr) "" #define GST_DEBUG_FUNCPTR_NAME(ptr) ""
#endif /* GST_DEBUG_ENABLED */ #endif /* GST_DEBUG_ENABLED */
gchar *_gst_debug_nameof_funcptr (void *ptr);
void gst_debug_print_stack_trace (void); void gst_debug_print_stack_trace (void);
#endif /* __GSTINFO_H__ */ #endif /* __GSTINFO_H__ */