[Xfce4-commits] <midori:master> Split -moz-document by both space and comma

Christian Dywan noreply at xfce.org
Wed Nov 9 22:08:01 CET 2011


Updating branch refs/heads/master
         to 5a786354b51336537025a1284613403b5324323f (commit)
       from 26658711be69331944dc5701fbda8fb67be26457 (commit)

commit 5a786354b51336537025a1284613403b5324323f
Author: Christian Dywan <christian at twotoasts.de>
Date:   Wed Nov 9 21:03:09 2011 +0100

    Split -moz-document by both space and comma
    
    Otherwise when only a comma was used only the first domain
    value would be picked up.

 extensions/addons.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/extensions/addons.c b/extensions/addons.c
index dee4206..076f0e9 100644
--- a/extensions/addons.c
+++ b/extensions/addons.c
@@ -1020,19 +1020,19 @@ css_metadata_from_file (const gchar* filename,
                      rest_of_line = g_strdup (line);
 
                  rest_of_line = g_strstrip (rest_of_line);
-                 line_has_meta  = g_str_has_suffix (rest_of_line, "{") ? FALSE : TRUE;
+                 line_has_meta  = !g_str_has_suffix (rest_of_line, "{");
 
-                 parts = g_strsplit (rest_of_line, " ", 0);
+                 parts = g_strsplit_set (rest_of_line, " ,", 0);
                  i = 0;
-                 while (parts[i] && (*parts[i] != '\0' && *parts[i] != '{'))
+                 while (parts[i] && *parts[i] != '{')
                  {
                      gchar* value = NULL;
                      if (g_str_has_prefix (parts[i], "url-prefix("))
-                         value = g_strdup (parts[i] + strlen ("url-prefix("));
+                        value = &parts[i][strlen ("url-prefix(")];
                      else if (g_str_has_prefix (parts[i], "domain("))
-                         value = g_strdup (parts[i] + strlen ("domain("));
+                        value = &parts[i][strlen ("domain(")];
                      else if (g_str_has_prefix (parts[i], "url("))
-                         value = g_strdup (parts[i] + strlen ("url("));
+                        value = &parts[i][strlen ("url(")];
                     if (value)
                     {
                          guint begin, end;
@@ -1054,7 +1054,6 @@ css_metadata_from_file (const gchar* filename,
 
                          re = addons_convert_to_simple_regexp (tmp_domain);
                          *includes = g_slist_prepend (*includes, re);
-                         g_free (value);
                          g_free (domain);
                     }
                     i++;


More information about the Xfce4-commits mailing list