Re: g_list_find
- From: Holczer Szilard <devellists freemail hu>
- To: gtk-app-devel-list gnome org
- Subject: Re: g_list_find
- Date: Tue, 27 Apr 2004 14:21:53 +0200 (CEST)
No, you can not use the g_node_find.
The code what you need, is something like this.
The original of this code is in the source of the glib2.4.0.
static gboolean
g_node_find_func (GNode *node,
gpointer data)
{
register gpointer *d = data;
if (!node->data || strcmp ((gchar *)data, (gchar
*)node->data))
return FALSE;
*(++d) = node;
return TRUE;
}
GNode*
g_node_find_string (GNode *root,
GTraverseType order,
GTraverseFlags flags,
gpointer data)
{
gpointer d[2];
g_return_val_if_fail (root != NULL, NULL);
g_return_val_if_fail (data != NULL, NULL);
g_return_val_if_fail (order <= G_LEVEL_ORDER, NULL);
g_return_val_if_fail (flags <= G_TRAVERSE_MASK, NULL);
d[0] = data;
d[1] = NULL;
g_node_traverse (root, order, flags, -1, g_node_find_func, d);
return d[1];
}
Does happen the same with GNode instead of GList when using
g_node_find?
How can i find a string in a GNode of strings?
Greetings.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]