[libgda] Fix warning on ITSignaler
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Fix warning on ITSignaler
- Date: Thu, 4 Apr 2019 19:48:49 +0000 (UTC)
commit 68ed91fb64dec3c9c56cd52da0aebbdeb6bfa3c9
Author: Daniel Espinosa <esodan gmail com>
Date: Wed Apr 3 17:11:31 2019 -0600
Fix warning on ITSignaler
libgda/gda-connection.c | 2 +-
libgda/thread-wrapper/gda-connect.c | 2 +-
libgda/thread-wrapper/gda-worker.c | 6 +++---
libgda/thread-wrapper/itsignaler.c | 6 +++---
libgda/thread-wrapper/itsignaler.h | 3 +--
libgda/thread-wrapper/test-itsignaler.c | 11 +++++++++--
6 files changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/libgda/gda-connection.c b/libgda/gda-connection.c
index ef6decd87..1bf9d24f1 100644
--- a/libgda/gda-connection.c
+++ b/libgda/gda-connection.c
@@ -6220,7 +6220,7 @@ typedef struct {
} TryLockData;
static gboolean
-itsignaler_trylock (ITSignaler *its, TryLockData *data)
+itsignaler_trylock (TryLockData *data)
{
if (gda_connection_trylock (data->lockable)) {
g_main_loop_quit (data->loop);
diff --git a/libgda/thread-wrapper/gda-connect.c b/libgda/thread-wrapper/gda-connect.c
index 812a89363..e44484fa4 100644
--- a/libgda/thread-wrapper/gda-connect.c
+++ b/libgda/thread-wrapper/gda-connect.c
@@ -186,7 +186,7 @@ sig_closure_marshal (GClosure *closure,
* programmer to be propagated, when a PassedData pointer is available through the ITS
*/
static gboolean
-propagate_signal (ITSignaler *its, SigClosure *sig_closure)
+propagate_signal (SigClosure *sig_closure)
{
PassedData *data;
data = itsignaler_pop_notification (sig_closure->signal_its, 0);
diff --git a/libgda/thread-wrapper/gda-worker.c b/libgda/thread-wrapper/gda-worker.c
index a72412bdf..9477106b5 100644
--- a/libgda/thread-wrapper/gda-worker.c
+++ b/libgda/thread-wrapper/gda-worker.c
@@ -714,10 +714,10 @@ gda_worker_forget_job (GdaWorker *worker, guint job_id)
}
static gboolean
-dc_callback (ITSignaler *its, DeclaredCallback *dc)
+dc_callback (DeclaredCallback *dc)
{
WorkerJob *job;
- job = itsignaler_pop_notification (its, 0);
+ job = itsignaler_pop_notification (dc->its, 0);
g_assert (job);
gpointer result;
@@ -841,7 +841,7 @@ do_timer_cb (GMainLoop *loop)
}
static gboolean
-do_itsignaler_cb (ITSignaler *its, GMainLoop *loop)
+do_itsignaler_cb (GMainLoop *loop)
{
if (g_main_loop_is_running (loop))
g_main_loop_quit (loop);
diff --git a/libgda/thread-wrapper/itsignaler.c b/libgda/thread-wrapper/itsignaler.c
index 45be69df5..2f364d0f6 100644
--- a/libgda/thread-wrapper/itsignaler.c
+++ b/libgda/thread-wrapper/itsignaler.c
@@ -664,7 +664,7 @@ itsignaler_push_notification (ITSignaler *its, gpointer data, GDestroyNotify des
static gpointer
itsignaler_pop_notification_non_block (ITSignaler *its)
{
- g_return_val_if_fail (its, NULL);
+ g_return_val_if_fail (its != NULL, NULL);
#ifdef G_OS_WIN32
guint8 value;
@@ -875,11 +875,11 @@ its_source_dispatch (GSource *source, GSourceFunc callback, gpointer user_data)
{
ITSSource *isource = (ITSSource*) source;
ITSignalerFunc func;
- func = IT_SIGNALER_FUNC (callback);
+ func = (ITSignalerFunc) callback;
gboolean retval;
itsignaler_ref (isource->its);
- retval = func (isource->its, user_data);
+ retval = func (user_data);
itsignaler_unref (isource->its);
return retval;
}
diff --git a/libgda/thread-wrapper/itsignaler.h b/libgda/thread-wrapper/itsignaler.h
index 91cd9fbe4..930bf5760 100644
--- a/libgda/thread-wrapper/itsignaler.h
+++ b/libgda/thread-wrapper/itsignaler.h
@@ -48,8 +48,7 @@ GSource *itsignaler_create_source (ITSignaler *its);
/*
* Returns: %FALSE if the source should be removed from the poll
*/
-typedef gboolean (*ITSignalerFunc) (ITSignaler *its, gpointer user_data);
-#define IT_SIGNALER_FUNC(f) ((ITSignalerFunc) (int (*)(ITSignaler*, void*)) (f))
+typedef gboolean (*ITSignalerFunc) (gpointer user_data);
guint itsignaler_add (ITSignaler *its, GMainContext *context, ITSignalerFunc func, gpointer data,
GDestroyNotify notify);
gboolean itsignaler_remove (ITSignaler *its, GMainContext *context, guint id);
diff --git a/libgda/thread-wrapper/test-itsignaler.c b/libgda/thread-wrapper/test-itsignaler.c
index 37daa2ed3..e3f4c44be 100644
--- a/libgda/thread-wrapper/test-itsignaler.c
+++ b/libgda/thread-wrapper/test-itsignaler.c
@@ -53,6 +53,7 @@ typedef struct {
} Data;
typedef struct {
+ ITSignaler *its;
gint counter;
GMainLoop *loop;
} CbData;
@@ -60,10 +61,15 @@ typedef struct {
static gpointer thread1_start (ITSignaler *its);
static gboolean
-source_callback (ITSignaler *its, CbData *cbdata)
+source_callback (CbData *cbdata)
{
Data *data;
- data = itsignaler_pop_notification (its, 0);
+ data = itsignaler_pop_notification (cbdata->its, 0);
+ if (data == NULL) {
+ g_warning ("No Data skiping");
+ g_main_loop_quit (cbdata->loop);
+ return FALSE;
+ }
if (cbdata->counter != data->counter) {
g_warning ("itsignaler_pop_notification() returned wrong value %d instead of %d",
cbdata->counter, data->counter);
@@ -113,6 +119,7 @@ test1 (void)
itsignaler_unref (its);
CbData cbdata;
+ cbdata.its = its;
cbdata.counter = 0;
cbdata.loop = loop;
g_source_set_callback (source, G_SOURCE_FUNC (source_callback), &cbdata, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]