Re: [Evolution-hackers] Avoiding a strdup in camel-folder-summar.c

Philip Van Hoof <[email protected]>
Newsgroups gmane.comp.gnome.evolution.patches,gmane.comp.gnome.evolution.devel
Message-ID <[email protected]>
On Tue, 2006-07-11 at 09:28 -0400, Chris Toshok wrote:

> static void
> free_token (gchar *token)
> {
> 	gint i;
> 
> 	for (i = 0; i < tokens_len; i ++)
> 		if (tokens[i] == token)
> 			return;
> 
> 	g_free (token);
> }

ps. Maybe for real efficiency you can also check whether the address of
token pointer isn't between the first and the last element of the static
table ;-)?

No really, yours is better. The point of my patch was to show that the
strdup can be avoided (and that valgrind shows me a significant reduc-
tion in used memory .. if you indeed avoid it).


-- 
Philip Van Hoof, software developer at x-tend 
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
work: vanhoof at x-tend dot be 
http://www.pvanhoof.be - http://www.x-tend.be
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.