[compiz] Just another ini patch

Mike Dransfield mike at blueroot.co.uk
Fri Apr 13 07:33:00 PDT 2007


Patrick Niklaus wrote:
> Hi,
>
> ok I hope this patches are now ok for you to commit.

Thanks.

The part which worries me is this

-    for (i=0; i<len; i++)
-    {
-    if (filename[i] == '-')
-    {
-        if (!pluginSep)
-        pluginSep = i-1;
-        else
-        return NULL; /*found a second dash */
-    }
-    else if (filename[i] == '.')
-    {
-        if (!screenSep)
-        screenSep = i-1;
-        else
-        return NULL; /*found a second dot */
-    }
-    }
+    /* the split point for the plugin name */
+    pluginSep = strrchr(filename, '-');
+    if (!pluginSep)
+    return NULL;
+
+    /* the split point for the screen name */
+    screenSep = strrchr(filename, '.');
+    if (!screenSep)
+    return NULL;

It is in a patch marked minor cleanup but it is actually changing
the functionality slightly.

In the original version I was keen to reject bad files as early as
possible so they couldn't cause any damage later.  Thats why I was
checking the entire filename.

Can you explain why you changed this bit (other than a slight speed
increase)?





More information about the compiz mailing list