summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-06-16 08:48:01 +0200
committerThomas Haller <thaller@redhat.com>2018-06-16 09:52:29 +0200
commitd7170e21fcf888ccbbc28141416102443c752f96 (patch)
treeed6962c4fde580ee537591749e9a3ff44a65567d
parentfa1f2bc26c969481f370aa58f5a40061e5802ab3 (diff)
downloadNetworkManager-d7170e21fcf888ccbbc28141416102443c752f96.tar.gz
ifnet: avoid compiler warning about casting function pointers
../../src/settings/plugins/ifnet/nms-ifnet-plugin.c: In function ‘monitor_file_changes’: ../../src/settings/plugins/ifnet/nms-ifnet-plugin.c:140:42: error: cast between incompatible function types from ‘void (*)(void *)’ to ‘void (*)(void *, GObject *)’ {aka ‘void (*)(void *, struct _GObject *)’} [-Werror=cast-function-type] g_object_weak_ref (G_OBJECT (monitor), (GWeakNotify) g_free, ^ (cherry picked from commit dccc449522aa7e5590da74a9be92afe02bae20d7)
-rw-r--r--src/settings/plugins/ifnet/nms-ifnet-plugin.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/settings/plugins/ifnet/nms-ifnet-plugin.c b/src/settings/plugins/ifnet/nms-ifnet-plugin.c
index 5d5d79bffa..00af56c408 100644
--- a/src/settings/plugins/ifnet/nms-ifnet-plugin.c
+++ b/src/settings/plugins/ifnet/nms-ifnet-plugin.c
@@ -118,6 +118,13 @@ file_changed (GFileMonitor * monitor,
}
}
+static void
+_weak_ref_cb (gpointer data,
+ GObject *where_the_object_was)
+{
+ g_free (data);
+}
+
static GFileMonitor *
monitor_file_changes (const char *filename,
FileChangedFn callback, gpointer user_data)
@@ -137,10 +144,10 @@ monitor_file_changes (const char *filename,
info = g_new0 (FileMonitorInfo, 1);
info->callback = callback;
info->user_data = user_data;
- g_object_weak_ref (G_OBJECT (monitor), (GWeakNotify) g_free,
- info);
+ g_object_weak_ref (G_OBJECT (monitor), _weak_ref_cb,
+ info);
g_signal_connect (monitor, "changed", G_CALLBACK (file_changed),
- info);
+ info);
} else {
nm_log_warn (LOGD_SETTINGS, "Monitoring %s failed, error: %s", filename,
error == NULL ? "nothing" : (*error)->message);