libfprint/SOURCES/0078-fp-device-Remove-unused-timeout-function-and-source-.patch
2021-09-09 20:12:48 +00:00

70 lines
2.1 KiB
Diff

From 1d5ec0b9787f5f3d48fe3a8539c35d23e51745d6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Wed, 4 Dec 2019 13:23:26 +0100
Subject: [PATCH 078/181] 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.
---
libfprint/fp-device.c | 22 +++++-----------------
1 file changed, 5 insertions(+), 17 deletions(-)
diff --git a/libfprint/fp-device.c b/libfprint/fp-device.c
index 182be51..334b998 100644
--- a/libfprint/fp-device.c
+++ b/libfprint/fp-device.c
@@ -1382,22 +1382,10 @@ fp_device_list_prints_finish (FpDevice *device,
typedef struct
{
- GSource source;
- FpDevice *device;
- FpTimeoutFunc callback;
- gpointer user_data;
+ GSource source;
+ FpDevice *device;
} FpDeviceTimeoutSource;
-gboolean
-device_timeout_cb (gpointer user_data)
-{
- FpDeviceTimeoutSource *source = user_data;
-
- source->callback (source->device, source->user_data);
-
- return G_SOURCE_REMOVE;
-}
-
void
timeout_finalize (GSource *source)
{
@@ -1409,11 +1397,12 @@ timeout_finalize (GSource *source)
}
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;
+ FpTimeoutFunc callback = (FpTimeoutFunc) gsource_func;
- ((FpTimeoutFunc) callback)(timeout_source->device, user_data);
+ callback (timeout_source->device, user_data);
return G_SOURCE_REMOVE;
}
@@ -1496,7 +1485,6 @@ fpi_device_add_timeout (FpDevice *device,
source = (FpDeviceTimeoutSource *) g_source_new (&timeout_funcs,
sizeof (FpDeviceTimeoutSource));
source->device = device;
- source->user_data = user_data;
g_source_attach (&source->source, NULL);
g_source_set_callback (&source->source, (GSourceFunc) func, user_data, destroy_notify);
--
2.24.1