[gnome-builder] safety: avoid cast of GDestroyNotify
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] safety: avoid cast of GDestroyNotify
- Date: Tue, 26 Feb 2019 02:45:01 +0000 (UTC)
commit 309825cf192756b5b4d92ca2bf5418b1d98628bf
Author: Christian Hergert <chergert redhat com>
Date: Mon Feb 25 18:42:13 2019 -0800
safety: avoid cast of GDestroyNotify
This allows us to introspect the type of the return pointer if
the callback is suitable to handle that parameter type.
In some cases, we need to use (ide_task_return_pointer)() which
could be worked around if we really cared to, but I'd rather not
for now until we deem it more useful to return NULL free
functions (or data).
src/libide/code/ide-code-index-entries.c | 4 ++--
src/libide/foundry/ide-build-system.c | 4 ++--
src/libide/foundry/ide-run-manager.c | 4 ++--
src/libide/io/ide-gfile.c | 4 ++--
src/libide/lsp/ide-lsp-client.c | 2 +-
src/libide/lsp/ide-lsp-rename-provider.c | 2 +-
src/libide/lsp/ide-lsp-symbol-resolver.c | 2 +-
src/libide/projects/ide-project-file.c | 2 +-
src/libide/sourceview/ide-source-search-context.c | 2 +-
src/libide/threading/ide-task.c | 6 +++---
src/libide/threading/ide-task.h | 25 ++++++++++++++++------
src/plugins/autotools/ide-autotools-build-system.c | 2 +-
.../ide-autotools-build-target-provider.c | 2 +-
.../buildsystem/gbp-buildsystem-workbench-addin.c | 2 +-
src/plugins/clang/ide-clang-client.c | 8 +++----
src/plugins/clang/ide-clang-code-index-entries.c | 4 ++--
src/plugins/clang/ide-clang-diagnostic-provider.c | 4 ++--
src/plugins/clang/ide-clang-proposals.c | 2 +-
src/plugins/clang/ide-clang-rename-provider.c | 2 +-
src/plugins/clang/ide-clang.c | 10 ++++-----
src/plugins/cmake/gbp-cmake-build-system.c | 2 +-
src/plugins/cmake/gbp-cmake-toolchain-provider.c | 2 +-
src/plugins/code-index/ide-code-index-index.c | 4 ++--
.../code-index/ide-code-index-search-provider.c | 2 +-
.../command-bar/gbp-command-bar-command-provider.c | 2 +-
src/plugins/ctags/ide-ctags-results.c | 2 +-
src/plugins/editor/gbp-editor-session-addin.c | 2 +-
src/plugins/file-search/gbp-file-search-provider.c | 2 +-
.../flatpak/gbp-flatpak-build-target-provider.c | 2 +-
src/plugins/flatpak/gbp-flatpak-config-provider.c | 2 +-
.../flatpak/gbp-flatpak-preferences-addin.c | 2 +-
src/plugins/gcc/gbp-gcc-toolchain-provider.c | 2 +-
src/plugins/gdb/gbp-gdb-debugger.c | 14 ++++++------
src/plugins/git/gbp-git-buffer-change-monitor.c | 2 +-
src/plugins/git/gbp-git-vcs.c | 4 ++--
src/plugins/ls/gbp-ls-model.c | 2 +-
src/plugins/meson/gbp-meson-build-system.c | 4 ++--
.../meson/gbp-meson-build-target-provider.c | 4 ++--
src/plugins/meson/gbp-meson-toolchain-provider.c | 2 +-
src/plugins/qemu/gbp-qemu-device-provider.c | 2 +-
src/plugins/spellcheck/gbp-spell-dict.c | 2 +-
src/plugins/sysprof/gbp-sysprof-workspace-addin.c | 4 ++--
.../sysroot/gbp-sysroot-toolchain-provider.c | 2 +-
src/plugins/vim/gbp-vim-command-provider.c | 2 +-
src/plugins/xml-pack/ide-xml-parser.c | 7 +++---
src/plugins/xml-pack/ide-xml-tree-builder.c | 4 ++--
46 files changed, 93 insertions(+), 81 deletions(-)
---
diff --git a/src/libide/code/ide-code-index-entries.c b/src/libide/code/ide-code-index-entries.c
index 68142a573..08fa2e728 100644
--- a/src/libide/code/ide-code-index-entries.c
+++ b/src/libide/code/ide-code-index-entries.c
@@ -54,7 +54,7 @@ ide_code_index_entries_real_next_entries_async (IdeCodeIndexEntries *self,
while ((entry = ide_code_index_entries_get_next_entry (self)))
g_ptr_array_add (ret, g_steal_pointer (&entry));
- ide_task_return_pointer (task, g_steal_pointer (&ret), (GDestroyNotify)g_ptr_array_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&ret), g_ptr_array_unref);
}
static GPtrArray *
@@ -217,7 +217,7 @@ ide_code_index_entries_collect_cb (GObject *object,
ide_task_return_pointer (task,
g_ptr_array_ref (task_data),
- (GDestroyNotify)g_ptr_array_unref);
+ g_ptr_array_unref);
}
/**
diff --git a/src/libide/foundry/ide-build-system.c b/src/libide/foundry/ide-build-system.c
index a45a834c0..e33d381a5 100644
--- a/src/libide/foundry/ide-build-system.c
+++ b/src/libide/foundry/ide-build-system.c
@@ -157,7 +157,7 @@ ide_build_system_get_build_flags_cb (GObject *object,
ide_task_return_pointer (task,
g_steal_pointer (&data->flags),
- (GDestroyNotify)g_hash_table_unref);
+ g_hash_table_unref);
}
static GPtrArray *
@@ -536,7 +536,7 @@ ide_build_system_get_build_flags_for_dir_cb2 (GObject *object,
else
ide_task_return_pointer (task,
g_steal_pointer (&ret),
- (GDestroyNotify)g_hash_table_unref);
+ g_hash_table_unref);
}
static void
diff --git a/src/libide/foundry/ide-run-manager.c b/src/libide/foundry/ide-run-manager.c
index 9c5ce5ae6..7359c762b 100644
--- a/src/libide/foundry/ide-run-manager.c
+++ b/src/libide/foundry/ide-run-manager.c
@@ -1020,8 +1020,8 @@ ide_run_manager_provider_get_targets_cb (GObject *object,
0,
(GDestroyNotify)ide_object_unref_and_destroy);
ide_task_return_pointer (task,
- g_steal_pointer (&first),
- (GDestroyNotify)ide_object_unref_and_destroy);
+ IDE_OBJECT (g_steal_pointer (&first)),
+ ide_object_unref_and_destroy);
IDE_EXIT;
}
diff --git a/src/libide/io/ide-gfile.c b/src/libide/io/ide-gfile.c
index b66feba7e..7eaef19e9 100644
--- a/src/libide/io/ide-gfile.c
+++ b/src/libide/io/ide-gfile.c
@@ -311,7 +311,7 @@ ide_g_file_get_children_worker (IdeTask *task,
ide_task_return_pointer (task,
g_steal_pointer (&children),
- (GDestroyNotify) g_ptr_array_unref);
+ g_ptr_array_unref);
}
static void
@@ -511,7 +511,7 @@ ide_g_file_find_worker (IdeTask *task,
ret = g_ptr_array_new_with_free_func (g_object_unref);
populate_descendants_matching (file, cancellable, ret, f->spec, f->depth);
- ide_task_return_pointer (task, g_steal_pointer (&ret), (GDestroyNotify)g_ptr_array_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&ret), g_ptr_array_unref);
}
/**
diff --git a/src/libide/lsp/ide-lsp-client.c b/src/libide/lsp/ide-lsp-client.c
index d48c58b76..68eb4a2f3 100644
--- a/src/libide/lsp/ide-lsp-client.c
+++ b/src/libide/lsp/ide-lsp-client.c
@@ -1107,7 +1107,7 @@ ide_lsp_client_call_cb (GObject *object,
else
ide_task_return_pointer (task,
g_steal_pointer (&reply),
- (GDestroyNotify)g_variant_unref);
+ g_variant_unref);
IDE_EXIT;
}
diff --git a/src/libide/lsp/ide-lsp-rename-provider.c b/src/libide/lsp/ide-lsp-rename-provider.c
index a990e2a07..123d2e1a1 100644
--- a/src/libide/lsp/ide-lsp-rename-provider.c
+++ b/src/libide/lsp/ide-lsp-rename-provider.c
@@ -226,7 +226,7 @@ ide_lsp_rename_provider_rename_cb (GObject *object,
}
}
- ide_task_return_pointer (task, g_steal_pointer (&ret), (GDestroyNotify)g_ptr_array_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&ret), g_ptr_array_unref);
IDE_EXIT;
}
diff --git a/src/libide/lsp/ide-lsp-symbol-resolver.c b/src/libide/lsp/ide-lsp-symbol-resolver.c
index e4ec44e3a..0bf9cf310 100644
--- a/src/libide/lsp/ide-lsp-symbol-resolver.c
+++ b/src/libide/lsp/ide-lsp-symbol-resolver.c
@@ -567,7 +567,7 @@ ide_lsp_symbol_resolver_find_references_cb (GObject *object,
g_ptr_array_add (references, g_steal_pointer (&range));
}
- ide_task_return_pointer (task, g_steal_pointer (&references), (GDestroyNotify)g_ptr_array_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&references), g_ptr_array_unref);
IDE_EXIT;
}
diff --git a/src/libide/projects/ide-project-file.c b/src/libide/projects/ide-project-file.c
index ebe18fa10..7ae36dac8 100644
--- a/src/libide/projects/ide-project-file.c
+++ b/src/libide/projects/ide-project-file.c
@@ -435,7 +435,7 @@ ide_project_file_list_children_cb (GObject *object,
ide_task_return_pointer (task,
g_steal_pointer (&ret),
- (GDestroyNotify)g_ptr_array_unref);
+ g_ptr_array_unref);
}
/**
diff --git a/src/libide/sourceview/ide-source-search-context.c
b/src/libide/sourceview/ide-source-search-context.c
index 1bd7a474d..0e12584b5 100644
--- a/src/libide/sourceview/ide-source-search-context.c
+++ b/src/libide/sourceview/ide-source-search-context.c
@@ -104,7 +104,7 @@ ide_source_search_context_backward_async (GtkSourceSearchContext *search,
g_object_ref (data->end);
}
- ide_task_return_pointer (task, data, (GDestroyNotify)search_data_free);
+ ide_task_return_pointer (task, data, search_data_free);
}
/**
diff --git a/src/libide/threading/ide-task.c b/src/libide/threading/ide-task.c
index a7a1aea9d..8e0780295 100644
--- a/src/libide/threading/ide-task.c
+++ b/src/libide/threading/ide-task.c
@@ -1277,9 +1277,9 @@ ide_task_return_object (IdeTask *self,
* Since: 3.32
*/
void
-ide_task_return_pointer (IdeTask *self,
- gpointer data,
- GDestroyNotify destroy)
+(ide_task_return_pointer) (IdeTask *self,
+ gpointer data,
+ GDestroyNotify destroy)
{
IdeTaskResult *ret;
diff --git a/src/libide/threading/ide-task.h b/src/libide/threading/ide-task.h
index 35d01a936..882ad883b 100644
--- a/src/libide/threading/ide-task.h
+++ b/src/libide/threading/ide-task.h
@@ -177,13 +177,24 @@ void ide_task_report_new_error (gpointer source_o
ide_task_set_name (__ide_task, g_intern_static_string (G_STRLOC)); \
__ide_task; \
})
-# define ide_task_set_task_data(t,d,n) \
- G_STMT_START { \
- __typeof__((d)) __task_data = (d); \
- (ide_task_set_task_data) ((t), \
- __task_data, \
- 0 ? (((n) (__task_data)), (GDestroyNotify)NULL) \
- : ((GDestroyNotify)(n))); \
+# define ide_task_set_task_data(t,d,n) \
+ G_STMT_START { \
+ __typeof__((d)) __task_data = (d); \
+ (ide_task_set_task_data) ((t), \
+ __task_data, \
+ 0 ? (((n) (__task_data)), (GDestroyNotify)NULL) \
+ : ((GDestroyNotify)(n))); \
+ } G_STMT_END
+# define ide_task_return_pointer(t,d,n) \
+ G_STMT_START { \
+ __typeof__((d)) __task_return = (d); \
+ if ((n) != NULL) \
+ (ide_task_return_pointer) ((t), \
+ __task_return, \
+ 0 ? (((n) (__task_return)), (GDestroyNotify)NULL) \
+ : ((GDestroyNotify)(n))); \
+ else \
+ (ide_task_return_pointer) ((t), __task_return, NULL); \
} G_STMT_END
#endif
diff --git a/src/plugins/autotools/ide-autotools-build-system.c
b/src/plugins/autotools/ide-autotools-build-system.c
index 3685bf2a7..9057e0e12 100644
--- a/src/plugins/autotools/ide-autotools-build-system.c
+++ b/src/plugins/autotools/ide-autotools-build-system.c
@@ -362,7 +362,7 @@ ide_autotools_build_system_get_file_flags_cb (GObject *object,
if (flags == NULL)
ide_task_return_error (task, g_steal_pointer (&error));
else
- ide_task_return_pointer (task, g_steal_pointer (&flags), (GDestroyNotify)g_strfreev);
+ ide_task_return_pointer (task, g_steal_pointer (&flags), g_strfreev);
IDE_EXIT;
}
diff --git a/src/plugins/autotools/ide-autotools-build-target-provider.c
b/src/plugins/autotools/ide-autotools-build-target-provider.c
index a1d673f91..e7e6d7528 100644
--- a/src/plugins/autotools/ide-autotools-build-target-provider.c
+++ b/src/plugins/autotools/ide-autotools-build-target-provider.c
@@ -65,7 +65,7 @@ ide_autotools_build_target_provider_get_targets_cb (GObject *object,
if (ret == NULL)
ide_task_return_error (task, g_steal_pointer (&error));
else
- ide_task_return_pointer (task, g_steal_pointer (&ret), (GDestroyNotify)g_ptr_array_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&ret), g_ptr_array_unref);
IDE_EXIT;
}
diff --git a/src/plugins/buildsystem/gbp-buildsystem-workbench-addin.c
b/src/plugins/buildsystem/gbp-buildsystem-workbench-addin.c
index 9d35f82a0..a1a7dd078 100644
--- a/src/plugins/buildsystem/gbp-buildsystem-workbench-addin.c
+++ b/src/plugins/buildsystem/gbp-buildsystem-workbench-addin.c
@@ -102,7 +102,7 @@ discovery_worker (IdeTask *task,
ide_extension_set_adapter_foreach (state->set, discovery_foreach_cb, state);
if (state->best_match != NULL)
- ide_task_return_pointer (task, (gpointer)state->best_match, NULL);
+ (ide_task_return_pointer) (task, (gpointer)state->best_match, NULL);
else
ide_task_return_new_error (task,
G_IO_ERROR,
diff --git a/src/plugins/clang/ide-clang-client.c b/src/plugins/clang/ide-clang-client.c
index 07eb43934..b0a6f993f 100644
--- a/src/plugins/clang/ide-clang-client.c
+++ b/src/plugins/clang/ide-clang-client.c
@@ -475,7 +475,7 @@ ide_clang_client_call_cb (GObject *object,
if (!jsonrpc_client_call_finish (rpc_client, result, &reply, &error))
ide_task_return_error (task, g_steal_pointer (&error));
else
- ide_task_return_pointer (task, g_steal_pointer (&reply), (GDestroyNotify)g_variant_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&reply), g_variant_unref);
}
static void
@@ -630,7 +630,7 @@ ide_clang_client_index_file_cb (GObject *object,
else
ide_task_return_pointer (task,
g_steal_pointer (&reply),
- (GDestroyNotify)g_variant_unref);
+ g_variant_unref);
}
void
@@ -1180,7 +1180,7 @@ ide_clang_client_get_highlight_index_cb (GObject *object,
else
ide_task_return_pointer (task,
ide_highlight_index_new_from_variant (reply),
- (GDestroyNotify)ide_highlight_index_unref);
+ ide_highlight_index_unref);
}
void
@@ -1257,7 +1257,7 @@ ide_clang_client_complete_cb (GObject *object,
if (!ide_clang_client_call_finish (self, result, &reply, &error))
ide_task_return_error (task, g_steal_pointer (&error));
else
- ide_task_return_pointer (task, g_steal_pointer (&reply), (GDestroyNotify)g_variant_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&reply), g_variant_unref);
}
void
diff --git a/src/plugins/clang/ide-clang-code-index-entries.c
b/src/plugins/clang/ide-clang-code-index-entries.c
index 46e69c4ed..af6a2ab51 100644
--- a/src/plugins/clang/ide-clang-code-index-entries.c
+++ b/src/plugins/clang/ide-clang-code-index-entries.c
@@ -127,7 +127,7 @@ ide_clang_code_index_entries_worker (IdeTask *task,
ide_task_return_pointer (task,
g_steal_pointer (&ret),
- (GDestroyNotify)g_ptr_array_unref);
+ g_ptr_array_unref);
}
static void
@@ -152,7 +152,7 @@ ide_clang_code_index_entries_next_entries_async (IdeCodeIndexEntries *entries,
if (self->has_run)
ide_task_return_pointer (task,
g_ptr_array_new_with_free_func ((GDestroyNotify)ide_code_index_entry_free),
- (GDestroyNotify)g_ptr_array_unref);
+ g_ptr_array_unref);
else
ide_task_run_in_thread (task, ide_clang_code_index_entries_worker);
diff --git a/src/plugins/clang/ide-clang-diagnostic-provider.c
b/src/plugins/clang/ide-clang-diagnostic-provider.c
index e5d9fb256..176c4832d 100644
--- a/src/plugins/clang/ide-clang-diagnostic-provider.c
+++ b/src/plugins/clang/ide-clang-diagnostic-provider.c
@@ -51,8 +51,8 @@ ide_clang_diagnostic_provider_diagnose_cb (GObject *object,
ide_task_return_error (task, g_steal_pointer (&error));
else
ide_task_return_pointer (task,
- g_steal_pointer (&diagnostics),
- (GDestroyNotify) g_ptr_array_unref);
+ IDE_OBJECT (g_steal_pointer (&diagnostics)),
+ ide_object_unref_and_destroy);
}
static void
diff --git a/src/plugins/clang/ide-clang-proposals.c b/src/plugins/clang/ide-clang-proposals.c
index 9106c9941..bfe5375e6 100644
--- a/src/plugins/clang/ide-clang-proposals.c
+++ b/src/plugins/clang/ide-clang-proposals.c
@@ -473,7 +473,7 @@ ide_clang_proposals_query_complete_cb (GObject *object,
else
ide_task_return_pointer (task,
g_steal_pointer (&variant),
- (GDestroyNotify)g_variant_unref);
+ g_variant_unref);
}
static void
diff --git a/src/plugins/clang/ide-clang-rename-provider.c b/src/plugins/clang/ide-clang-rename-provider.c
index f57aa963d..af9cf502d 100644
--- a/src/plugins/clang/ide-clang-rename-provider.c
+++ b/src/plugins/clang/ide-clang-rename-provider.c
@@ -115,7 +115,7 @@ ide_clang_rename_provider_communicate_cb (GObject *object,
edits = g_ptr_array_new_full (1, g_object_unref);
g_ptr_array_add (edits, g_steal_pointer (&edit));
- ide_task_return_pointer (task, g_steal_pointer (&edits), (GDestroyNotify)g_ptr_array_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&edits), g_ptr_array_unref);
IDE_EXIT;
}
diff --git a/src/plugins/clang/ide-clang.c b/src/plugins/clang/ide-clang.c
index 808a73537..da34a2c98 100644
--- a/src/plugins/clang/ide-clang.c
+++ b/src/plugins/clang/ide-clang.c
@@ -732,7 +732,7 @@ ide_clang_index_file_worker (IdeTask *task,
ide_task_return_pointer (task,
g_steal_pointer (&state->entries),
- (GDestroyNotify)g_ptr_array_unref);
+ g_ptr_array_unref);
}
/**
@@ -1062,7 +1062,7 @@ ide_clang_diagnose_worker (IdeTask *task,
ide_task_return_pointer (task,
g_steal_pointer (&state->diagnostics),
- (GDestroyNotify)g_ptr_array_unref);
+ g_ptr_array_unref);
}
/**
@@ -1291,7 +1291,7 @@ ide_clang_complete_worker (IdeTask *task,
ide_task_return_pointer (task,
g_variant_ref_sink (g_variant_builder_end (&builder)),
- (GDestroyNotify)g_variant_unref);
+ g_variant_unref);
}
void
@@ -1836,7 +1836,7 @@ ide_clang_get_symbol_tree_worker (IdeTask *task,
clang_visitChildren (cursor, traverse_cursors, state);
ret = g_variant_ref_sink (g_variant_builder_end (&builder));
- ide_task_return_pointer (task, g_steal_pointer (&ret), (GDestroyNotify)g_variant_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&ret), g_variant_unref);
}
void
@@ -2027,7 +2027,7 @@ ide_clang_get_highlight_index_worker (IdeTask *task,
ide_task_return_pointer (task,
g_steal_pointer (&highlight),
- (GDestroyNotify)ide_highlight_index_unref);
+ ide_highlight_index_unref);
}
void
diff --git a/src/plugins/cmake/gbp-cmake-build-system.c b/src/plugins/cmake/gbp-cmake-build-system.c
index 684831d45..67616c02f 100644
--- a/src/plugins/cmake/gbp-cmake-build-system.c
+++ b/src/plugins/cmake/gbp-cmake-build-system.c
@@ -478,7 +478,7 @@ gbp_cmake_build_system_get_build_flags_cb (GObject *object,
if (build_flags == NULL)
ide_task_return_error (task, g_steal_pointer (&error));
else
- ide_task_return_pointer (task, g_steal_pointer (&build_flags), (GDestroyNotify)g_strfreev);
+ ide_task_return_pointer (task, g_steal_pointer (&build_flags), g_strfreev);
}
static void
diff --git a/src/plugins/cmake/gbp-cmake-toolchain-provider.c
b/src/plugins/cmake/gbp-cmake-toolchain-provider.c
index 11b53245f..db89fe106 100644
--- a/src/plugins/cmake/gbp-cmake-toolchain-provider.c
+++ b/src/plugins/cmake/gbp-cmake-toolchain-provider.c
@@ -105,7 +105,7 @@ gbp_cmake_toolchain_provider_load_worker (IdeTask *task,
}
}
- ide_task_return_pointer (task, g_steal_pointer (&toolchains), (GDestroyNotify)g_ptr_array_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&toolchains), g_ptr_array_unref);
}
static void
diff --git a/src/plugins/code-index/ide-code-index-index.c b/src/plugins/code-index/ide-code-index-index.c
index 17127d8fd..86357d5fb 100644
--- a/src/plugins/code-index/ide-code-index-index.c
+++ b/src/plugins/code-index/ide-code-index-index.c
@@ -450,7 +450,7 @@ ide_code_index_index_query_cb (GObject *object,
ide_task_return_pointer (task,
g_steal_pointer (&results),
- (GDestroyNotify)g_ptr_array_unref);
+ g_ptr_array_unref);
}
}
@@ -533,7 +533,7 @@ ide_code_index_index_populate_async (IdeCodeIndexIndex *self,
{
ide_task_return_pointer (task,
g_ptr_array_new_with_free_func (g_object_unref),
- (GDestroyNotify) g_ptr_array_unref);
+ g_ptr_array_unref);
}
}
diff --git a/src/plugins/code-index/ide-code-index-search-provider.c
b/src/plugins/code-index/ide-code-index-search-provider.c
index 68abbbadc..4648820f3 100644
--- a/src/plugins/code-index/ide-code-index-search-provider.c
+++ b/src/plugins/code-index/ide-code-index-search-provider.c
@@ -46,7 +46,7 @@ populate_cb (GObject *object,
if (results != NULL)
ide_task_return_pointer (task,
g_steal_pointer (&results),
- (GDestroyNotify)g_ptr_array_unref);
+ g_ptr_array_unref);
else
ide_task_return_error (task, g_steal_pointer (&error));
}
diff --git a/src/plugins/command-bar/gbp-command-bar-command-provider.c
b/src/plugins/command-bar/gbp-command-bar-command-provider.c
index e84be23be..9da24cca2 100644
--- a/src/plugins/command-bar/gbp-command-bar-command-provider.c
+++ b/src/plugins/command-bar/gbp-command-bar-command-provider.c
@@ -155,7 +155,7 @@ gbp_command_bar_command_provider_query_async (IdeCommandProvider *provider,
ide_task_return_pointer (task,
g_steal_pointer (&results),
- (GDestroyNotify)g_ptr_array_unref);
+ g_ptr_array_unref);
}
static GPtrArray *
diff --git a/src/plugins/ctags/ide-ctags-results.c b/src/plugins/ctags/ide-ctags-results.c
index 4900210ba..ba0c2c2f5 100644
--- a/src/plugins/ctags/ide-ctags-results.c
+++ b/src/plugins/ctags/ide-ctags-results.c
@@ -203,7 +203,7 @@ ide_ctags_results_populate_worker (IdeTask *task,
ide_task_return_pointer (task,
g_array_ref (p->items),
- (GDestroyNotify)g_array_unref);
+ g_array_unref);
}
#if 0
diff --git a/src/plugins/editor/gbp-editor-session-addin.c b/src/plugins/editor/gbp-editor-session-addin.c
index ebd9501f7..c758defa9 100644
--- a/src/plugins/editor/gbp-editor-session-addin.c
+++ b/src/plugins/editor/gbp-editor-session-addin.c
@@ -231,7 +231,7 @@ gbp_editor_session_addin_save_async (IdeSessionAddin *addin,
ide_task_return_pointer (task,
g_variant_take_ref (g_variant_builder_end (&builder)),
- (GDestroyNotify)g_variant_unref);
+ g_variant_unref);
IDE_EXIT;
}
diff --git a/src/plugins/file-search/gbp-file-search-provider.c
b/src/plugins/file-search/gbp-file-search-provider.c
index ad9b3b13a..d49091146 100644
--- a/src/plugins/file-search/gbp-file-search-provider.c
+++ b/src/plugins/file-search/gbp-file-search-provider.c
@@ -70,7 +70,7 @@ gbp_file_search_provider_search_async (IdeSearchProvider *provider,
else
results = g_ptr_array_new_with_free_func (g_object_unref);
- ide_task_return_pointer (task, g_steal_pointer (&results), (GDestroyNotify)g_ptr_array_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&results), g_ptr_array_unref);
}
static GPtrArray *
diff --git a/src/plugins/flatpak/gbp-flatpak-build-target-provider.c
b/src/plugins/flatpak/gbp-flatpak-build-target-provider.c
index 178423065..9638f8ae9 100644
--- a/src/plugins/flatpak/gbp-flatpak-build-target-provider.c
+++ b/src/plugins/flatpak/gbp-flatpak-build-target-provider.c
@@ -71,7 +71,7 @@ gbp_flatpak_build_target_provider_get_targets_async (IdeBuildTargetProvider *pro
ide_task_return_pointer (task,
g_steal_pointer (&targets),
- (GDestroyNotify)g_ptr_array_unref);
+ g_ptr_array_unref);
}
static GPtrArray *
diff --git a/src/plugins/flatpak/gbp-flatpak-config-provider.c
b/src/plugins/flatpak/gbp-flatpak-config-provider.c
index 550fb33f4..fb70087cb 100644
--- a/src/plugins/flatpak/gbp-flatpak-config-provider.c
+++ b/src/plugins/flatpak/gbp-flatpak-config-provider.c
@@ -342,7 +342,7 @@ gbp_flatpak_config_provider_load_worker (IdeTask *task,
ide_task_return_pointer (task,
g_steal_pointer (&manifests),
- (GDestroyNotify)g_ptr_array_unref);
+ g_ptr_array_unref);
}
static void
diff --git a/src/plugins/flatpak/gbp-flatpak-preferences-addin.c
b/src/plugins/flatpak/gbp-flatpak-preferences-addin.c
index 04e4f2087..d047829c2 100644
--- a/src/plugins/flatpak/gbp-flatpak-preferences-addin.c
+++ b/src/plugins/flatpak/gbp-flatpak-preferences-addin.c
@@ -244,7 +244,7 @@ gbp_flatpak_preferences_addin_reload_worker (IdeTask *task,
g_ptr_array_sort (runtimes, compare_refs);
}
- ide_task_return_pointer (task, g_steal_pointer (&runtimes), (GDestroyNotify)g_ptr_array_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&runtimes), g_ptr_array_unref);
IDE_EXIT;
}
diff --git a/src/plugins/gcc/gbp-gcc-toolchain-provider.c b/src/plugins/gcc/gbp-gcc-toolchain-provider.c
index 564245c75..93c2df8f2 100644
--- a/src/plugins/gcc/gbp-gcc-toolchain-provider.c
+++ b/src/plugins/gcc/gbp-gcc-toolchain-provider.c
@@ -172,7 +172,7 @@ gbp_gcc_toolchain_provider_load_worker (IdeTask *task,
ide_task_return_pointer (task,
g_steal_pointer (&toolchains),
- (GDestroyNotify)g_ptr_array_unref);
+ g_ptr_array_unref);
}
static void
diff --git a/src/plugins/gdb/gbp-gdb-debugger.c b/src/plugins/gdb/gbp-gdb-debugger.c
index 1743e0bec..5fc516dad 100644
--- a/src/plugins/gdb/gbp-gdb-debugger.c
+++ b/src/plugins/gdb/gbp-gdb-debugger.c
@@ -278,7 +278,7 @@ gbp_gdb_debugger_handle_result (GbpGdbDebugger *self,
if (task != NULL)
{
- ide_task_return_pointer (task, output, (GDestroyNotify)gdbwire_mi_output_free);
+ ide_task_return_pointer (task, output, gdbwire_mi_output_free);
return;
}
@@ -1049,7 +1049,7 @@ gbp_gdb_debugger_list_breakpoints_cb (GObject *object,
}
}
- ide_task_return_pointer (task, g_steal_pointer (&ar), (GDestroyNotify)g_ptr_array_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&ar), g_ptr_array_unref);
gdbwire_mi_command_free (command);
gdbwire_mi_output_free (output);
@@ -1615,7 +1615,7 @@ gbp_gdb_debugger_list_frames_cb (GObject *object,
}
}
- ide_task_return_pointer (task, g_steal_pointer (&ar), (GDestroyNotify)g_ptr_array_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&ar), g_ptr_array_unref);
cleanup:
g_clear_pointer (&output, gdbwire_mi_output_free);
@@ -1964,7 +1964,7 @@ gbp_gdb_debugger_handle_list_variables (GObject *object,
}
}
- ide_task_return_pointer (task, g_steal_pointer (&ar), (GDestroyNotify)g_ptr_array_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&ar), g_ptr_array_unref);
cleanup:
g_clear_pointer (&output, gdbwire_mi_output_free);
@@ -2152,7 +2152,7 @@ gbp_gdb_debugger_list_registers_cb (GObject *object,
}
}
- ide_task_return_pointer (task, g_steal_pointer (&ar), (GDestroyNotify)g_ptr_array_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&ar), g_ptr_array_unref);
cleanup:
g_clear_pointer (&output, gdbwire_mi_output_free);
@@ -2263,7 +2263,7 @@ gbp_gdb_debugger_disassemble_cb (GObject *object,
}
}
- ide_task_return_pointer (task, g_steal_pointer (&ar), (GDestroyNotify)g_ptr_array_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&ar), g_ptr_array_unref);
cleanup:
g_clear_pointer (&output, gdbwire_mi_output_free);
@@ -2775,7 +2775,7 @@ gbp_gdb_debugger_exec_async (GbpGdbDebugger *self,
* synthesize a NULL response.
*/
g_string_append_printf (str, "%s\n", command);
- ide_task_return_pointer (task, NULL, NULL);
+ (ide_task_return_pointer) (task, NULL, NULL);
}
DEBUG_LOG ("to-gdb", str->str);
diff --git a/src/plugins/git/gbp-git-buffer-change-monitor.c b/src/plugins/git/gbp-git-buffer-change-monitor.c
index 0aa4664f6..72f3ce13f 100644
--- a/src/plugins/git/gbp-git-buffer-change-monitor.c
+++ b/src/plugins/git/gbp-git-buffer-change-monitor.c
@@ -832,7 +832,7 @@ gbp_git_buffer_change_monitor_worker (gpointer data)
else
ide_task_return_pointer (task,
g_steal_pointer (&diff->cache),
- (GDestroyNotify)line_cache_free);
+ line_cache_free);
}
return NULL;
diff --git a/src/plugins/git/gbp-git-vcs.c b/src/plugins/git/gbp-git-vcs.c
index aee3d522f..b70e0f683 100644
--- a/src/plugins/git/gbp-git-vcs.c
+++ b/src/plugins/git/gbp-git-vcs.c
@@ -489,7 +489,7 @@ gbp_git_vcs_list_branches_worker (IdeTask *task,
ide_task_return_pointer (task,
g_steal_pointer (&branches),
- (GDestroyNotify)g_ptr_array_unref);
+ g_ptr_array_unref);
}
else
{
@@ -589,7 +589,7 @@ gbp_git_vcs_list_tags_worker (IdeTask *task,
ide_task_return_pointer (task,
g_steal_pointer (&tags),
- (GDestroyNotify)g_ptr_array_unref);
+ g_ptr_array_unref);
}
else
{
diff --git a/src/plugins/ls/gbp-ls-model.c b/src/plugins/ls/gbp-ls-model.c
index ba81e51ac..0703fbd3f 100644
--- a/src/plugins/ls/gbp-ls-model.c
+++ b/src/plugins/ls/gbp-ls-model.c
@@ -464,7 +464,7 @@ gbp_ls_model_worker (IdeTask *task,
ide_task_return_pointer (task,
g_steal_pointer (&items),
- (GDestroyNotify)g_ptr_array_unref);
+ g_ptr_array_unref);
}
static void
diff --git a/src/plugins/meson/gbp-meson-build-system.c b/src/plugins/meson/gbp-meson-build-system.c
index 710c8b554..bcdcb5423 100644
--- a/src/plugins/meson/gbp-meson-build-system.c
+++ b/src/plugins/meson/gbp-meson-build-system.c
@@ -527,7 +527,7 @@ gbp_meson_build_system_get_build_flags_for_files_cb (GObject *object,
g_hash_table_insert (ret, g_object_ref (file), g_steal_pointer (&flags));
}
- ide_task_return_pointer (task, g_steal_pointer (&ret), (GDestroyNotify)g_hash_table_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&ret), g_hash_table_unref);
}
static void
@@ -579,7 +579,7 @@ gbp_meson_build_system_get_build_flags_cb (GObject *object,
if (ret == NULL)
ide_task_return_error (task, g_steal_pointer (&error));
else
- ide_task_return_pointer (task, g_steal_pointer (&ret), (GDestroyNotify)g_strfreev);
+ ide_task_return_pointer (task, g_steal_pointer (&ret), g_strfreev);
}
static void
diff --git a/src/plugins/meson/gbp-meson-build-target-provider.c
b/src/plugins/meson/gbp-meson-build-target-provider.c
index e5db950e8..64b115ac4 100644
--- a/src/plugins/meson/gbp-meson-build-target-provider.c
+++ b/src/plugins/meson/gbp-meson-build-target-provider.c
@@ -144,7 +144,7 @@ gbp_meson_build_target_provider_communicate_cb2 (GObject *object,
name,
NULL,
IDE_ARTIFACT_KIND_EXECUTABLE));
- ide_task_return_pointer (task, g_steal_pointer (&ret), (GDestroyNotify)g_ptr_array_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&ret), g_ptr_array_unref);
return;
}
@@ -292,7 +292,7 @@ gbp_meson_build_target_provider_communicate_cb (GObject *object,
if (ret->len > 0 && found_bindir)
{
- ide_task_return_pointer (task, g_steal_pointer (&ret), (GDestroyNotify)g_ptr_array_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&ret), g_ptr_array_unref);
return;
}
diff --git a/src/plugins/meson/gbp-meson-toolchain-provider.c
b/src/plugins/meson/gbp-meson-toolchain-provider.c
index ba8afd07a..9c5131726 100644
--- a/src/plugins/meson/gbp-meson-toolchain-provider.c
+++ b/src/plugins/meson/gbp-meson-toolchain-provider.c
@@ -129,7 +129,7 @@ gbp_meson_toolchain_provider_load_worker (IdeTask *task,
ide_task_return_pointer (task,
g_steal_pointer (&toolchains),
- (GDestroyNotify)g_ptr_array_unref);
+ g_ptr_array_unref);
}
static void
diff --git a/src/plugins/qemu/gbp-qemu-device-provider.c b/src/plugins/qemu/gbp-qemu-device-provider.c
index 9b9d05afa..29028bdfc 100644
--- a/src/plugins/qemu/gbp-qemu-device-provider.c
+++ b/src/plugins/qemu/gbp-qemu-device-provider.c
@@ -172,7 +172,7 @@ gbp_qemu_device_provider_load_worker (IdeTask *task,
ide_task_return_pointer (task,
g_steal_pointer (&devices),
- (GDestroyNotify)g_ptr_array_unref);
+ g_ptr_array_unref);
IDE_EXIT;
}
diff --git a/src/plugins/spellcheck/gbp-spell-dict.c b/src/plugins/spellcheck/gbp-spell-dict.c
index c56497a86..7b2d09d42 100644
--- a/src/plugins/spellcheck/gbp-spell-dict.c
+++ b/src/plugins/spellcheck/gbp-spell-dict.c
@@ -133,7 +133,7 @@ read_line_cb (GObject *object,
ide_task_return_error (task, g_steal_pointer (&error));
}
else
- ide_task_return_pointer (task, state->hash_table, (GDestroyNotify)g_hash_table_unref);
+ ide_task_return_pointer (task, g_steal_pointer (&state->hash_table), g_hash_table_unref);
}
else
{
diff --git a/src/plugins/sysprof/gbp-sysprof-workspace-addin.c
b/src/plugins/sysprof/gbp-sysprof-workspace-addin.c
index 6933a5ea6..1ce7e67fa 100644
--- a/src/plugins/sysprof/gbp-sysprof-workspace-addin.c
+++ b/src/plugins/sysprof/gbp-sysprof-workspace-addin.c
@@ -319,10 +319,10 @@ gbp_sysprof_workspace_addin_open_worker (IdeTask *task,
path = g_file_get_path (file);
- if (NULL == (reader = sp_capture_reader_new (path, &error)))
+ if (!(reader = sp_capture_reader_new (path, &error)))
ide_task_return_error (task, g_steal_pointer (&error));
else
- ide_task_return_pointer (task, reader, (GDestroyNotify)sp_capture_reader_unref);
+ ide_task_return_pointer (task, reader, sp_capture_reader_unref);
}
static void
diff --git a/src/plugins/sysroot/gbp-sysroot-toolchain-provider.c
b/src/plugins/sysroot/gbp-sysroot-toolchain-provider.c
index 89c858ba6..c21112879 100644
--- a/src/plugins/sysroot/gbp-sysroot-toolchain-provider.c
+++ b/src/plugins/sysroot/gbp-sysroot-toolchain-provider.c
@@ -219,7 +219,7 @@ gbp_sysroot_toolchain_provider_load_worker (IdeTask *task,
ide_task_return_pointer (task,
g_steal_pointer (&toolchains),
- (GDestroyNotify)g_ptr_array_unref);
+ g_ptr_array_unref);
IDE_EXIT;
}
diff --git a/src/plugins/vim/gbp-vim-command-provider.c b/src/plugins/vim/gbp-vim-command-provider.c
index 951950692..7a739b9aa 100644
--- a/src/plugins/vim/gbp-vim-command-provider.c
+++ b/src/plugins/vim/gbp-vim-command-provider.c
@@ -81,7 +81,7 @@ gbp_vim_command_provider_query_async (IdeCommandProvider *provider,
no_active_widget:
ide_task_return_pointer (task,
g_steal_pointer (&results),
- (GDestroyNotify)g_ptr_array_unref);
+ g_ptr_array_unref);
}
static GPtrArray *
diff --git a/src/plugins/xml-pack/ide-xml-parser.c b/src/plugins/xml-pack/ide-xml-parser.c
index 5f4ad31cd..55313764b 100644
--- a/src/plugins/xml-pack/ide-xml-parser.c
+++ b/src/plugins/xml-pack/ide-xml-parser.c
@@ -575,8 +575,7 @@ ide_xml_parser_get_analysis_worker (IdeTask *task,
if (self->post_processing_callback != NULL)
(self->post_processing_callback)(self, state->root_node);
- analysis = g_steal_pointer (&state->analysis);
- if (analysis == NULL)
+ if (!(analysis = g_steal_pointer (&state->analysis)))
{
ide_task_return_new_error (task,
G_IO_ERROR,
@@ -606,7 +605,9 @@ ide_xml_parser_get_analysis_worker (IdeTask *task,
ide_xml_analysis_set_schemas (analysis, g_steal_pointer (&state->schemas));
ide_xml_analysis_set_sequence (analysis, state->sequence);
- ide_task_return_pointer (task, analysis, (GDestroyNotify)ide_xml_analysis_unref);
+ ide_task_return_pointer (task,
+ g_steal_pointer (&analysis),
+ ide_xml_analysis_unref);
}
void
diff --git a/src/plugins/xml-pack/ide-xml-tree-builder.c b/src/plugins/xml-pack/ide-xml-tree-builder.c
index 01973325f..9cdcb2432 100644
--- a/src/plugins/xml-pack/ide-xml-tree-builder.c
+++ b/src/plugins/xml-pack/ide-xml-tree-builder.c
@@ -417,7 +417,7 @@ ide_xml_tree_builder_parse_worker (IdeTask *task,
ide_task_return_pointer (task,
g_steal_pointer (&state->analysis),
- (GDestroyNotify)ide_xml_analysis_unref);
+ ide_xml_analysis_unref);
}
static void
@@ -479,7 +479,7 @@ ide_xml_tree_builder_build_tree_cb (GObject *object,
{
ide_task_return_pointer (task,
g_steal_pointer (&analysis),
- (GDestroyNotify)ide_xml_analysis_unref);
+ ide_xml_analysis_unref);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]