[Xfce4-commits] <midori:master> Use g_access instead of g_file_test in katze_mkdir_with_parents

Christian Dywan noreply at xfce.org
Fri Dec 18 21:22:03 CET 2009


Updating branch refs/heads/master
         to 670ee72e3f4d55e5e14d75a90912e4c022053ae8 (commit)
       from 8c724eccd9e83c54dee91e15f85e40fb34af60bc (commit)

commit 670ee72e3f4d55e5e14d75a90912e4c022053ae8
Author: Alexander Butenko <a.butenka at gmail.com>
Date:   Fri Dec 18 21:21:02 2009 +0100

    Use g_access instead of g_file_test in katze_mkdir_with_parents

 katze/katze-utils.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/katze/katze-utils.c b/katze/katze-utils.c
index f5566c8..60329eb 100644
--- a/katze/katze-utils.c
+++ b/katze/katze-utils.c
@@ -21,6 +21,10 @@
     #include "config.h"
 #endif
 
+#if HAVE_UNISTD_H
+    #include <unistd.h>
+#endif
+
 #ifdef HAVE_HILDON_2_2
     #include <hildon/hildon.h>
 #endif
@@ -1340,7 +1344,8 @@ katze_mkdir_with_parents (const gchar* pathname,
 {
   gchar* fn, *p;
 
-  if (g_file_test (pathname, G_FILE_TEST_EXISTS))
+  /* Use g_access instead of g_file_test for better performance */
+  if (g_access (pathname, F_OK) == 0)
       return 0;
 
   fn = g_strdup (pathname);
@@ -1360,7 +1365,7 @@ katze_mkdir_with_parents (const gchar* pathname,
       else
           *p = '\0';
 
-      if (!g_file_test (fn, G_FILE_TEST_EXISTS))
+      if (g_access (fn, F_OK) != 0)
       {
           if (g_mkdir (fn, mode) == -1)
           {



More information about the Xfce4-commits mailing list