app/app_procs.c app/base/temp-buf.c app/core/gimpmodules.c
2002-02-18 Sven Neumann <sven@gimp.org> * app/app_procs.c * app/base/temp-buf.c * app/core/gimpmodules.c * app/plug-in/plug-in.c * libgimpbase/gimpenv.c * libgimpwidgets/gimpfileselection.c * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/flame/flame.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gimpressionist/gimpressionist.[ch]: use g_file_test() instead of stat() whereever possible. Improves code readability.
This commit is contained in:

committed by
Sven Neumann

parent
fb8c94c0a4
commit
fe2c9e8bbf
@ -23,9 +23,11 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@ -287,9 +289,7 @@ gimp_path_parse (const gchar *path,
|
||||
GList *list = NULL;
|
||||
GList *fail_list = NULL;
|
||||
gint i;
|
||||
|
||||
struct stat filestat;
|
||||
gint err = FALSE;
|
||||
gboolean exists = TRUE;
|
||||
|
||||
if (!path || !*path || max_paths < 1 || max_paths > 256)
|
||||
return NULL;
|
||||
@ -321,11 +321,10 @@ gimp_path_parse (const gchar *path,
|
||||
_fnslashify (dir);
|
||||
#endif
|
||||
|
||||
/* check if directory exists */
|
||||
if (check)
|
||||
err = stat (dir->str, &filestat);
|
||||
exists = g_file_test (dir->str, G_FILE_TEST_IS_DIR);
|
||||
|
||||
if (!err)
|
||||
if (exists)
|
||||
list = g_list_prepend (list, g_strdup (dir->str));
|
||||
else if (check_failed)
|
||||
fail_list = g_list_prepend (fail_list, g_strdup (dir->str));
|
||||
|
Reference in New Issue
Block a user