Store a pointer to the real parent in reparent dirs.

This commit is contained in:
Vreixo Formoso 2007-12-23 17:41:21 +01:00
parent 811655a9a1
commit 227b17f251
2 changed files with 10 additions and 0 deletions

View File

@ -651,6 +651,9 @@ int reparent(Ecma119Node *child, Ecma119Node *parent)
return ISO_ERROR;
}
/* keep track of the real parent */
child->info.dir.real_parent = child->parent;
/* add the child to its new parent */
child->parent = parent;
parent->info.dir.nchildren++;

View File

@ -29,6 +29,11 @@ struct ecma119_dir_info {
size_t nchildren;
Ecma119Node **children;
/**
* Real parent if the dir has been reallocated. NULL otherwise.
*/
Ecma119Node *real_parent;
};
/**
@ -51,6 +56,8 @@ struct ecma119_node
enum ecma119_node_type type;
union {
IsoFileSrc *file;
// TODO this wastes too much memory, as dirs have much more
// atts than other kind of files. Replace with a pointer.
struct ecma119_dir_info dir;
/** this field points to the relocated directory. */
Ecma119Node *real_me;