summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sf.net>2010-03-29 16:05:44 +0300
committerStefan Kost <ensonic@users.sf.net>2010-03-29 16:36:15 +0300
commit04bf54c58f2df65fda597e499fa8c2f3bc277017 (patch)
tree03cbeeb20bb219b0caf8ed1be6eab07ceea5c976
parentf38d864bf75178abe1cb7a8e78f5232b10909756 (diff)
info: readd the use of GstDebugFuncPtr typedef and tell why
-rw-r--r--gst/gstinfo.c11
-rw-r--r--gst/gstinfo.h15
2 files changed, 15 insertions, 11 deletions
diff --git a/gst/gstinfo.c b/gst/gstinfo.c
index af2f4cf933..6858b83765 100644
--- a/gst/gstinfo.c
+++ b/gst/gstinfo.c
@@ -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)";
}
diff --git a/gst/gstinfo.h b/gst/gstinfo.h
index f34ccb6836..4cb11321ed 100644
--- a/gst/gstinfo.h
+++ b/gst/gstinfo.h
@@ -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 */