Only stat when needed.

2004-03-01  Morten Welinder  <terra@gnome.org>

	* gtk/gtkfilesystemunix.c (filename_get_info): Only stat when
	needed.
This commit is contained in:
Morten Welinder 2004-03-01 20:07:26 +00:00 committed by Morten Welinder
parent 8ddff5b098
commit b45b1536a9
6 changed files with 21 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2004-03-01 Morten Welinder <terra@gnome.org>
* gtk/gtkfilesystemunix.c (filename_get_info): Only stat when
needed.
* gtk/gtkfilesystemmodel.c (file_model_node_is_visible): Simplify
semantics and check for errors.

View File

@ -1,5 +1,8 @@
2004-03-01 Morten Welinder <terra@gnome.org>
* gtk/gtkfilesystemunix.c (filename_get_info): Only stat when
needed.
* gtk/gtkfilesystemmodel.c (file_model_node_is_visible): Simplify
semantics and check for errors.

View File

@ -1,5 +1,8 @@
2004-03-01 Morten Welinder <terra@gnome.org>
* gtk/gtkfilesystemunix.c (filename_get_info): Only stat when
needed.
* gtk/gtkfilesystemmodel.c (file_model_node_is_visible): Simplify
semantics and check for errors.

View File

@ -1,5 +1,8 @@
2004-03-01 Morten Welinder <terra@gnome.org>
* gtk/gtkfilesystemunix.c (filename_get_info): Only stat when
needed.
* gtk/gtkfilesystemmodel.c (file_model_node_is_visible): Simplify
semantics and check for errors.

View File

@ -1,5 +1,8 @@
2004-03-01 Morten Welinder <terra@gnome.org>
* gtk/gtkfilesystemunix.c (filename_get_info): Only stat when
needed.
* gtk/gtkfilesystemmodel.c (file_model_node_is_visible): Simplify
semantics and check for errors.

View File

@ -1358,10 +1358,15 @@ filename_get_info (const gchar *filename,
{
GtkFileInfo *info;
struct stat statbuf;
gboolean do_stat = (types & (GTK_FILE_INFO_IS_FOLDER |
GTK_FILE_INFO_IS_HIDDEN |
GTK_FILE_INFO_MODIFICATION_TIME |
GTK_FILE_INFO_SIZE));
/* If stat fails, try to fall back to lstat to catch broken links
*/
if (stat (filename, &statbuf) != 0 &&
if (do_stat &&
stat (filename, &statbuf) != 0 &&
lstat (filename, &statbuf) != 0)
{
gchar *filename_utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);