Glib: g_tree_foreach and GTransverseFunc questions.
- From: Lucas Brasilino <brasilino prrr mpf gov br>
- To: gtk-list gnome org
- Subject: Glib: g_tree_foreach and GTransverseFunc questions.
- Date: Fri, 19 Aug 2005 12:22:51 -0400
Hi!
I'm writing a little daemon which I'm storing
user login and IP address as key and value pair
respectively, which I malloc()ed buffers for both,
using Balanced Binary Tree interface
from Glib 2.6.4. I'm using FC4. Eventually I compile
it with Glib 2.4.8 in a FC3 box.
I'm creating a tree with g_tree_new() and destroying
it with g_tree_destroy(). But before destroying it
I'm tranversing the entire tree with g_tree_foreach()
and free()ing both key and value.
It seems to work fine, since valgrind tells there's
no memory leak.
But I have no idea what user_data argument is used for
within g_tree_foreach() neither data argument of
GTransverseFunc. Any explanation ?
I've made user_data as NULL and did't touch
GTransverseFunc's data argument:
g_tree_foreach (SIConfig->tree, freeKeyData, NULL);
gboolean
freeKeyData (gpointer key, gpointer value, gpointer data)
{
free (key);
free (data);
return FALSE;
}
It works.. :) but...
thanks a lot in advance
--
[]'s
Lucas Brasilino
brasilino prrr mpf gov br
Procuradoria da República no Estado de Roraima
+55-95-6239642
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]