repo: rxvt-unicode-sixel
action: commit
revision: 
path_from: 
revision_from: 654615e9292b86713865d72df2a8305fb52f4530:
path_to: 
revision_to: 
git.thebackupbox.net
rxvt-unicode-sixel
git clone git://git.thebackupbox.net/rxvt-unicode-sixel
commit 654615e9292b86713865d72df2a8305fb52f4530
Author: Emanuele Giaquinta 
Date:   Mon Jan 10 19:58:24 2011 +0000

    Simplify parsing of bg image operations using rxvt_strsplit.

diff --git a/src/background.C b/src/background.C
index bcb85ff5c2a58fff177a0e48be2166f3ff192a6b..
index ..245da9362c07811abf7109098e6ec054cd9adcca 100644
--- a/src/background.C
+++ b/src/background.C
@@ -309,11 +309,11 @@ bgPixmap_t::set_geometry (const char *geom, bool update)

   if (ops)
     {
-      while (*ops)
-        {
-          while (*ops == ':' || isspace(*ops)) ++ops;
+      char **arr = rxvt_strsplit (':', ops + 1);

-#  define CHECK_GEOM_OPS(op_str)  (strncasecmp (ops, (op_str), sizeof (op_str) - 1) == 0)
+      for (int i = 0; arr[i]; i++) 
+        {
+#  define CHECK_GEOM_OPS(op_str)  (strcasecmp (arr[i], (op_str)) == 0)
           if (CHECK_GEOM_OPS ("tile"))
             {
               w = h = noScale;
@@ -357,9 +357,9 @@ bgPixmap_t::set_geometry (const char *geom, bool update)
               geom_flags |= WidthValue|HeightValue;
             }
 #  undef CHECK_GEOM_OPS
-
-          while (*ops != ':' && *ops != '\0') ++ops;
         } /* done parsing ops */
+
+      rxvt_free_strsplit (arr);
     }

   if (check_set_scale_value (geom_flags, WidthValue, h_scale, w))  changed = true;

-----END OF PAGE-----