[compiz] Just another ini patch

Patrick Niklaus patrick.niklaus at googlemail.com
Fri Apr 13 07:58:56 PDT 2007


2007/4/13, Mike Dransfield <mike at blueroot.co.uk>:
> 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)?
>
>
>
>

First point is, as you mentioned, a speed increase. Second point is
that it takes less space and looks much cleaner. But if you are
worried about files with names like "foo.bla-hehe" (which would be
invalid) I could add a check for that of course.

Regards,
Patrick


More information about the compiz mailing list