info: readd the use of GstDebugFuncPtr typedef and tell why

This reverts the related changes from 3f4954e42d
and ffb0a4e190.
This commit is contained in:
Stefan Kost 2010-03-29 16:05:44 +03:00
parent f38d864bf7
commit 04bf54c58f
2 changed files with 15 additions and 11 deletions

View file

@ -1510,10 +1510,9 @@ static GStaticMutex __dbg_functions_mutex = G_STATIC_MUTEX_INIT;
/* This function MUST NOT return NULL */
const gchar *
_gst_debug_nameof_funcptr (gpointer ptr)
_gst_debug_nameof_funcptr (GstDebugFuncPtr func)
{
gchar *ptrname;
GstDebugFuncPtr func = (GstDebugFuncPtr) ptr;
#ifdef HAVE_DLADDR
Dl_info dl_info;
@ -1550,8 +1549,10 @@ _gst_debug_nameof_funcptr (gpointer ptr)
}
void
_gst_debug_register_funcptr (gpointer ptr, const gchar * ptrname)
_gst_debug_register_funcptr (GstDebugFuncPtr func, const gchar * ptrname)
{
gpointer ptr = (gpointer) func;
g_static_mutex_lock (&__dbg_functions_mutex);
if (!__gst_function_pointers)
@ -1690,13 +1691,13 @@ _gst_debug_category_new (const gchar * name, guint color,
}
void
_gst_debug_register_funcptr (gpointer func, const gchar * ptrname)
_gst_debug_register_funcptr (GstDebugFuncPtr func, const gchar * ptrname)
{
}
/* This function MUST NOT return NULL */
const gchar *
_gst_debug_nameof_funcptr (gpointer func)
_gst_debug_nameof_funcptr (GstDebugFuncPtr func)
{
return "(NULL)";
}

View file

@ -306,14 +306,17 @@ void _gst_debug_dump_mem (GstDebugCategory * cat, const gchar * file,
const gchar * func, gint line, GObject * obj, const gchar * msg,
const guint8 * data, guint length);
/* FIXME:0.11 remove, we don't use it */
/* we define this to avoid a compiler warning regarding a cast from a function
* pointer to a void pointer
* (see https://bugzilla.gnome.org/show_bug.cgi?id=309253)
*/
typedef void (* GstDebugFuncPtr) (void);
/* do no use these functions, use the GST_DEBUG*_FUNCPTR macros */
void _gst_debug_register_funcptr (gpointer func,
void _gst_debug_register_funcptr (GstDebugFuncPtr func,
const gchar * ptrname);
G_CONST_RETURN gchar *
_gst_debug_nameof_funcptr (gpointer func) G_GNUC_NO_INSTRUMENT;
_gst_debug_nameof_funcptr (GstDebugFuncPtr func) G_GNUC_NO_INSTRUMENT;
#ifndef GST_DISABLE_GST_DEBUG
@ -1118,7 +1121,7 @@ GST_FIXME (const char *format, ...)
* Since: 0.10.26
*/
#define GST_DEBUG_REGISTER_FUNCPTR(ptr) \
_gst_debug_register_funcptr((gpointer)(ptr), #ptr)
_gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr)
/**
* GST_DEBUG_FUNCPTR:
* @ptr: pointer to the function to register
@ -1129,7 +1132,7 @@ GST_FIXME (const char *format, ...)
* Returns: the value passed to @ptr.
*/
#define GST_DEBUG_FUNCPTR(ptr) \
(_gst_debug_register_funcptr((gpointer)(ptr), #ptr) , ptr)
(_gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr) , ptr)
/**
* GST_DEBUG_FUNCPTR_NAME:
@ -1142,7 +1145,7 @@ GST_FIXME (const char *format, ...)
* freed by the caller.
*/
#define GST_DEBUG_FUNCPTR_NAME(ptr) \
_gst_debug_nameof_funcptr((gpointer)ptr)
_gst_debug_nameof_funcptr((GstDebugFuncPtr)ptr)
#else /* GST_DISABLE_GST_DEBUG */