From ecb56e91a1e7d333162b668e5facf4a9fc6377d3 Mon Sep 17 00:00:00 2001 From: Klaus Ethgen Date: Thu, 25 Feb 2016 16:48:22 +0100 Subject: [PATCH] Reintroduce file_data_new_simple() This was removed by Vladimir with efc8096527d6f743d17c44b9982616a169973f39 to always check for sidecars. However, the newly introduced function file_data_new_group() is very expensive. Having it in collection (in sort manager) where the dirs of that files have huge amount of files inside, that is simply blocking whole geeqie. It might be that the file_data_new_group() function need to be disarmed on other places too. --- src/collect-io.c | 2 +- src/filedata.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/collect-io.c b/src/collect-io.c index aab9c52e..0336108e 100644 --- a/src/collect-io.c +++ b/src/collect-io.c @@ -162,7 +162,7 @@ static gboolean collection_load_private(CollectionData *cd, const gchar *path, C if (!flush) changed |= collect_manager_process_action(entry, &buf); - valid = (buf[0] == G_DIR_SEPARATOR && collection_add_check(cd, file_data_new_group(buf), FALSE, TRUE)); + valid = (buf[0] == G_DIR_SEPARATOR && collection_add_check(cd, file_data_new_simple(buf), FALSE, TRUE)); if (!valid) DEBUG_1("collection invalid file: %s", buf); total++; diff --git a/src/filedata.c b/src/filedata.c index c99f3a91..c4e0525a 100644 --- a/src/filedata.c +++ b/src/filedata.c @@ -414,6 +414,27 @@ static FileData *file_data_new_local(const gchar *path, struct stat *st, gboolea return ret; } +FileData *file_data_new_simple(const gchar *path_utf8) +{ + struct stat st; + FileData *fd; + + if (!stat_utf8(path_utf8, &st)) + { + st.st_size = 0; + st.st_mtime = 0; + } + + fd = g_hash_table_lookup(file_data_pool, path_utf8); + if (!fd) fd = file_data_new(path_utf8, &st, TRUE); + if (fd) + { + file_data_ref(fd); + } + + return fd; +} + void init_exif_time_data(GList *files) { FileData *file; -- 2.20.1