int n_attributes;
RecordDataString *data;
RecordDataString **attributes;
- GList *children;
+ GList link;
+ GQueue children;
};
typedef struct {
tree->parent = parent;
tree->type = type;
tree->data = data;
+ tree->link.data = tree;
if (parent)
- parent->children = g_list_prepend (parent->children, tree);
+ g_queue_push_tail_link (&parent->children, &tree->link);
return tree;
}
static void
record_data_tree_free (RecordDataTree *tree)
{
- g_list_free_full (tree->children, (GDestroyNotify)record_data_tree_free);
+ GList *l, *next;
+
+ l = tree->children.head;
+ while (l)
+ {
+ next = l->next;
+ record_data_tree_free (l->data);
+ l = next;
+ }
+
g_free (tree->attributes);
g_slice_free (RecordDataTree, tree);
}
/* Special case the root */
if (tree->parent == NULL)
{
- for (l = g_list_last (tree->children); l != NULL; l = l->prev)
+ for (l = tree->children.head; l != NULL; l = l->next)
marshal_tree (marshaled, l->data);
return;
}
marshal_uint32 (marshaled, attr_names[i]->offset);
marshal_uint32 (marshaled, attr_values[i]->offset);
}
- for (l = g_list_last (tree->children); l != NULL; l = l->prev)
+ for (l = tree->children.head; l != NULL; l = l->next)
marshal_tree (marshaled, l->data);
marshal_uint32 (marshaled, RECORD_TYPE_END_ELEMENT);