]> spindle.queued.net Git - midori/commitdiff
Adblock: Check if file is up to date before parsing it
authorPaweł Forysiuk <tuxator@o2.pl>
Sat, 1 Sep 2012 15:54:30 +0000 (17:54 +0200)
committerChristian Dywan <christian@twotoasts.de>
Sat, 1 Sep 2012 16:13:14 +0000 (18:13 +0200)
extensions/adblock.c

index 8939c6890dba0486f5e6b269bc70b438e4ed7f9b..f38aa2a6ee472ffa46879a951140434c84bd703a 100644 (file)
@@ -43,7 +43,7 @@ static GHashTable* blockcssprivate = NULL;
 static GHashTable* navigationwhitelist = NULL;
 static GString* blockcss = NULL;
 
-static gboolean
+static void
 adblock_parse_file (gchar* path);
 
 static gboolean
@@ -226,8 +226,7 @@ adblock_reload_rules (MidoriExtension* extension,
                 continue;
             }
 
-            if (!adblock_parse_file (path)
-            ||  !adblock_file_is_up_to_date (path))
+            if (!adblock_file_is_up_to_date (path))
             {
                 WebKitNetworkRequest* request;
                 WebKitDownload* download;
@@ -242,6 +241,8 @@ adblock_reload_rules (MidoriExtension* extension,
                     G_CALLBACK (adblock_download_notify_status_cb), extension);
                 webkit_download_start (download);
             }
+            else
+                adblock_parse_file (path);
             g_free (path);
             i++;
         }
@@ -1596,7 +1597,7 @@ adblock_file_is_up_to_date (gchar* path)
     return FALSE;
 }
 
-static gboolean
+static void
 adblock_parse_file (gchar* path)
 {
     FILE* file;
@@ -1607,9 +1608,7 @@ adblock_parse_file (gchar* path)
         while (fgets (line, 2000, file))
             adblock_parse_line (line);
         fclose (file);
-        return TRUE;
     }
-    return FALSE;
 }
 
 static void