[Xfce4-commits] <garcon:master> Optimize the garcon_menu_directory_get_show_in_environment fucntion.

Jannis Pohlmann jannis at xfce.org
Mon Aug 17 18:43:23 CEST 2009


On Mon, 17 Aug 2009 16:16:02 +0000 (UTC)
Nick Schermer <nick at xfce.org> wrote:

> Updating branch refs/heads/master
>          to 389d7c4cf3c04d9c563cada7f09d710adbc5261d (commit)
>        from 5e86ee0b43af1449e6fb25dcfd29b8f8caa5eeca (commit)
> 
> commit 389d7c4cf3c04d9c563cada7f09d710adbc5261d
> Author: Nick Schermer <nick at xfce.org>
> Date:   Mon Aug 17 17:27:37 2009 +0200
> 
> -      /* If it's not, don't show the menu */
> -      if (G_LIKELY (!included))
> -        show = FALSE;
> +      /* Check if your environemnt is in OnlyShowIn list */
> +      for (i = 0; directory->priv->only_show_in[i] != NULL; i++)
> +        if (g_utf8_collate (directory->priv->only_show_in[i], env)
> == 0)
> +          return TRUE;

Please don't return from loops. In my opinion this is bad coding style,
so I'd prefer not to see it in garcon. You may or may not like it,
but please use something like this:

for (i = 0; !found && i < n; ++i) 
  if (condition_met)
    found = true

Cheers,
Jannis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://mail.xfce.org/pipermail/xfce4-dev/attachments/20090817/8f2aa5f5/attachment.pgp>


More information about the Xfce4-dev mailing list