[amtk] utils: fix compilation warning with g_clear_pointer()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [amtk] utils: fix compilation warning with g_clear_pointer()
- Date: Fri, 6 Sep 2019 15:01:09 +0000 (UTC)
commit 0598aac3e5a25bd689cdecade58251d250ac1b45
Author: Sébastien Wilmet <swilmet gnome org>
Date: Fri Sep 6 16:48:32 2019 +0200
utils: fix compilation warning with g_clear_pointer()
The warning was:
amtk-utils.c: In function ‘amtk_utils_bind_g_action_to_gtk_action’:
amtk-utils.c:359:34: warning: function called through a non-compatible type
359 | g_clear_pointer (&target_value, (GDestroyNotify)g_variant_unref);
/usr/include/glib-2.0/glib/gmem.h:121:8: note: in definition of macro ‘g_clear_pointer’
121 | (destroy) (_ptr); \
| ^~~~~~~
Setting target_value to NULL afterwards is not needed because it's the
end of the function.
amtk/amtk-utils.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/amtk/amtk-utils.c b/amtk/amtk-utils.c
index 61e2f4d..a6e8fad 100644
--- a/amtk/amtk-utils.c
+++ b/amtk/amtk-utils.c
@@ -356,7 +356,11 @@ amtk_utils_bind_g_action_to_gtk_action (GActionMap *g_action_map,
out:
g_free (g_action_name);
- g_clear_pointer (&target_value, (GDestroyNotify)g_variant_unref);
+
+ if (target_value != NULL)
+ {
+ g_variant_unref (target_value);
+ }
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]