[Xfce4-commits] r30225 - in xfce4-appfinder/trunk: . src

Nick Schermer nickschermer at gmail.com
Thu Jul 9 08:57:30 CEST 2009


2009/7/9 Colin Leroy <colin at xfce.org>:
> On Thu, 9 Jul 2009 08:25:01 +0200, Nick Schermer wrote:
>
> Hi,
>
>> > +      categories_array = g_new0 (const gchar *, g_list_length
>> > (categories) + 1); +
>> > +      for (lp = categories, n = 0; lp != NULL; lp = lp->next, ++n)
>> > +        categories_array[n] = lp->data;
>
> gchar *tmp = NULL, *categories_string = NULL;
>
> for (lp = categories; lp != NULL; lp = lp->next)
>  {
>    tmp = g_strdup_printf("%s%s%s",
>             categories_string ? categories_string : "",
>             categories_string ? ", " : "",
>             lp->data);
>    g_free(categories_string);
>    categories_string = tmp;
>  }
>

That's even worse... Hint: eventually you append to a GString.

Nick



More information about the Xfce4-dev mailing list