[gnome-builder/wip/lantw/fix-a-few-errors-for-clang: 4/5] io: don't use nested functions
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/lantw/fix-a-few-errors-for-clang: 4/5] io: don't use nested functions
- Date: Wed, 24 Jul 2019 05:58:59 +0000 (UTC)
commit 2c4ee66c438228f7292ccf53a9632e35b38fe096
Author: Ting-Wei Lan <lantw src gnome org>
Date: Sat Jul 20 15:58:57 2019 +0800
io: don't use nested functions
Nested function is a non-standard feature supported by GCC as an
extension. Since the function doesn't depend on any local variables
defined in the outer scope, we can simply move it out of the function.
This fixes compilation error with clang.
src/libide/io/ide-gfile.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/src/libide/io/ide-gfile.c b/src/libide/io/ide-gfile.c
index 30aa6b970..b42cfba11 100644
--- a/src/libide/io/ide-gfile.c
+++ b/src/libide/io/ide-gfile.c
@@ -324,6 +324,16 @@ get_children_free (gpointer data)
g_slice_free (GetChildren, gc);
}
+#ifdef DEVELOPMENT_BUILD
+static gboolean
+delayed_run (gpointer data)
+{
+ g_autoptr(IdeTask) subtask = data;
+ ide_task_run_in_thread (subtask, ide_g_file_get_children_worker);
+ return G_SOURCE_REMOVE;
+}
+#endif
+
/**
* ide_g_file_get_children_async:
* @file: a #IdeGlib
@@ -371,13 +381,6 @@ ide_g_file_get_children_async (GFile *file,
/* Useful for testing slow interactions on project-tree and such */
if (g_getenv ("IDE_G_FILE_DELAY"))
{
- gboolean
- delayed_run (gpointer data)
- {
- g_autoptr(IdeTask) subtask = data;
- ide_task_run_in_thread (subtask, ide_g_file_get_children_worker);
- return G_SOURCE_REMOVE;
- }
g_timeout_add_seconds (1, delayed_run, g_object_ref (task));
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]