fp-device: Remove unused timeout function and source data

These were probably added in previous iterations, but they are not uneeded
anymore as the GSource embeds already a callback function.

So make just this clearer in the dispatch function.
This commit is contained in:
Marco Trevisan (Treviño) 2019-12-04 13:23:26 +01:00
parent 1d48b70f38
commit 2f2ea65d32

View file

@ -1384,20 +1384,8 @@ typedef struct
{ {
GSource source; GSource source;
FpDevice *device; FpDevice *device;
FpTimeoutFunc callback;
gpointer user_data;
} FpDeviceTimeoutSource; } FpDeviceTimeoutSource;
gboolean
device_timeout_cb (gpointer user_data)
{
FpDeviceTimeoutSource *source = user_data;
source->callback (source->device, source->user_data);
return G_SOURCE_REMOVE;
}
void void
timeout_finalize (GSource *source) timeout_finalize (GSource *source)
{ {
@ -1409,11 +1397,12 @@ timeout_finalize (GSource *source)
} }
static gboolean static gboolean
timeout_dispatch (GSource *source, GSourceFunc callback, gpointer user_data) timeout_dispatch (GSource *source, GSourceFunc gsource_func, gpointer user_data)
{ {
FpDeviceTimeoutSource *timeout_source = (FpDeviceTimeoutSource *) source; FpDeviceTimeoutSource *timeout_source = (FpDeviceTimeoutSource *) source;
FpTimeoutFunc callback = (FpTimeoutFunc) gsource_func;
((FpTimeoutFunc) callback)(timeout_source->device, user_data); callback (timeout_source->device, user_data);
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
} }
@ -1496,7 +1485,6 @@ fpi_device_add_timeout (FpDevice *device,
source = (FpDeviceTimeoutSource *) g_source_new (&timeout_funcs, source = (FpDeviceTimeoutSource *) g_source_new (&timeout_funcs,
sizeof (FpDeviceTimeoutSource)); sizeof (FpDeviceTimeoutSource));
source->device = device; source->device = device;
source->user_data = user_data;
g_source_attach (&source->source, NULL); g_source_attach (&source->source, NULL);
g_source_set_callback (&source->source, (GSourceFunc) func, user_data, destroy_notify); g_source_set_callback (&source->source, (GSourceFunc) func, user_data, destroy_notify);