[evolution-rss] reduce the number of reads when looking up main folder
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-rss] reduce the number of reads when looking up main folder
- Date: Sun, 9 Sep 2012 14:24:32 +0000 (UTC)
commit 7a3f335fa79cef6112d43b5ff2b91e350f5332e6
Author: Lucian Langa <lucilanga gnome org>
Date: Sun Sep 9 16:23:08 2012 +0200
reduce the number of reads when looking up main folder
src/rss-config.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/rss-config.c b/src/rss-config.c
index 19599c1..4017399 100644
--- a/src/rss-config.c
+++ b/src/rss-config.c
@@ -32,6 +32,7 @@
extern rssfeed *rf;
GSList *rss_list = NULL;
+static gchar *rss_main_folder = NULL;
static gboolean
xml_set_content (xmlNodePtr node, char **val)
@@ -599,6 +600,9 @@ get_main_folder(void)
gchar *feed_file;
gchar *feed_dir = rss_component_peek_base_directory();
+ if (rss_main_folder)
+ goto out;
+
if (!g_file_test(feed_dir, G_FILE_TEST_EXISTS))
g_mkdir_with_parents (feed_dir, 0755);
feed_file = g_strdup_printf("%s" G_DIR_SEPARATOR_S "main_folder", feed_dir);
@@ -608,12 +612,14 @@ get_main_folder(void)
if (f && fgets(mf, 511, f) != NULL) {
fclose(f);
g_free(feed_file);
- return g_strdup(mf);
+ rss_main_folder = g_strdup(mf);
+ goto out;
}
fclose(f);
}
g_free(feed_file);
- return g_strdup(DEFAULT_FEEDS_FOLDER);
+ rss_main_folder = g_strdup(DEFAULT_FEEDS_FOLDER);
+out: return g_strdup(rss_main_folder);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]