Re: [Evolution-hackers] [evolution-patches] Avoiding a strdup in camel-folder-summar.c
- From: Ritesh Khadgaray <khadgaray gmail com>
- To: Chris Toshok <toshok ximian com>
- Cc: Evolution Patches <evolution-patches gnome org>, evolution-hackers gnome org, Philip Van Hoof <spam pvanhoof be>
- Subject: Re: [Evolution-hackers] [evolution-patches] Avoiding a strdup in camel-folder-summar.c
- Date: Wed, 12 Jul 2006 02:27:35 +0530
On Tue, 2006-07-11 at 09:28 -0400, Chris Toshok wrote:
> No opinion on the rest of the patch, but this:
>
> > +static void
> > +free_token (gchar *token)
> > +{
> > + gint i=0;
> > + gboolean no=FALSE;
> > +
> > + for (i=0; (i < tokens_len); i++)
> > + {
> > + if (tokens[i] == token)
> > + no = TRUE;
> > + }
> > +
> > + if (!no)
> > + g_free (token);
> > +}
> > +
>
> is more efficient as:
>
> static void
> free_token (gchar *token)
> {
> gint i;
>
> for (i = 0; i < tokens_len; i ++)
> if (tokens[i] == token)
> return;
out of curiosity, the first patch reads through the list
and this patch, return if any one of the token is equal, anf not any
following it.
Would the below not be better ?
for (i = 0; i < tokens_len; i ++)
if (tokens[i] == token)
break;
--
Ritesh Khadgaray
LinuX N Stuff
Ph: +919822394463
Eat Right, Exercise, Die Anyway.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]