From 28ae7873c2aa3867cb1fb24eea1606d88004ce96 Mon Sep 17 00:00:00 2001 From: Antoine Fontaine <antoine.fontaine@epfl.ch> Date: Wed, 12 Jun 2019 12:52:14 +0200 Subject: [PATCH] Better name for write_file: write_file_async --- src/moodle-provider.c | 6 +++--- src/utils.c | 2 +- src/utils.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/moodle-provider.c b/src/moodle-provider.c index 388413a..a19ead7 100644 --- a/src/moodle-provider.c +++ b/src/moodle-provider.c @@ -254,7 +254,7 @@ got_course_content_cb (GInputStream *is, read_g_input_stream (is, &html, &html_size); struct CourseContent content = moodle_parse_course_content (html, html_size, filename); if (should_save_to_disk) - write_file (filename, g_steal_pointer (&html), html_size); + write_file_async (filename, g_steal_pointer (&html), html_size); final_cb (user_data, &content); } @@ -272,7 +272,7 @@ got_folder_content_cb (GInputStream *is, read_g_input_stream (is, &html, &html_size); struct FolderContent content = moodle_parse_folder_content (html, html_size, filename); if (should_save_to_disk) - write_file (filename, g_steal_pointer (&html), html_size); + write_file_async (filename, g_steal_pointer (&html), html_size); final_cb (user_data, &content); } @@ -304,7 +304,7 @@ moodle_provider_get_courses_sync (courses_cb cb, } read_g_input_stream (index, &html, &html_size); courses = moodle_parse_course_list (html, html_size, filename); - write_file (filename, g_steal_pointer (&html), html_size); + write_file_async (filename, g_steal_pointer (&html), html_size); } else { // offline mode diff --git a/src/utils.c b/src/utils.c index 7bdaedc..3d5d496 100644 --- a/src/utils.c +++ b/src/utils.c @@ -103,7 +103,7 @@ write_file_cb (GObject *object, } void -write_file (const char *name, char *content, size_t size) +write_file_async (const char *name, char *content, size_t size) { g_autoptr (GFile) file = g_file_new_for_uri (name); g_file_replace_contents_async (file, diff --git a/src/utils.h b/src/utils.h index 54ff66e..826ba63 100644 --- a/src/utils.h +++ b/src/utils.h @@ -26,9 +26,9 @@ gchar *get_index_filename (void); void read_file (const char *name, char **content, size_t *size); -// write_file is responsible for freeing content +// write_file_async is responsible for freeing content void -write_file (const char *name, char *content, size_t size); +write_file_async (const char *name, char *content, size_t size); void read_g_input_stream (GInputStream *is, char **content, size_t *size); -- GitLab