[Xfce4-commits] <midori:master> No need to g_access when checking cached file, fopen is enough

Christian Dywan noreply at xfce.org
Tue Dec 22 00:20:05 CET 2009


Updating branch refs/heads/master
         to 61266c26ecda1d5e61dc93b080339f04b2febcae (commit)
       from eddb3ef55773d20865cf6d5c67232ab9b499517d (commit)

commit 61266c26ecda1d5e61dc93b080339f04b2febcae
Author: Alexander Butenko <a.butenka at gmail.com>
Date:   Mon Dec 21 23:48:51 2009 +0100

    No need to g_access when checking cached file, fopen is enough

 extensions/web-cache.c |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/extensions/web-cache.c b/extensions/web-cache.c
index 7a07e8a..7a43bec 100644
--- a/extensions/web-cache.c
+++ b/extensions/web-cache.c
@@ -92,12 +92,6 @@ web_cache_get_headers (gchar* filename)
         return NULL;
 
     dsc_filename = g_strdup_printf ("%s.dsc", filename);
-    if (g_access (dsc_filename, R_OK) != 0)
-    {
-        g_free (dsc_filename);
-        return NULL;
-    }
-
     headers = g_hash_table_new_full (g_str_hash, g_str_equal,
                                (GDestroyNotify)g_free,
                                (GDestroyNotify)g_free);
@@ -107,10 +101,12 @@ web_cache_get_headers (gchar* filename)
         gchar line[128];
         while (fgets (line, 128, file))
         {
+            gchar** data;
+
             if (line == NULL)
                 continue;
+
             g_strchomp (line);
-            gchar** data;
             data = g_strsplit (line, ":", 2);
             if (data[0] && data[1])
                 g_hash_table_insert (headers, g_strdup (data[0]),
@@ -118,12 +114,12 @@ web_cache_get_headers (gchar* filename)
             g_strfreev (data);
         }
         fclose (file);
+        g_free (dsc_filename);
+        return headers;
     }
-    else
-        g_hash_table_destroy (headers);
-
+    g_hash_table_destroy (headers);
     g_free (dsc_filename);
-    return headers;
+    return NULL;
 }
 
 static gboolean



More information about the Xfce4-commits mailing list