diff --git a/src/ecma119_tree.c b/src/ecma119_tree.c index 7f1969a..e4d1370 100644 --- a/src/ecma119_tree.c +++ b/src/ecma119_tree.c @@ -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++; diff --git a/src/ecma119_tree.h b/src/ecma119_tree.h index d609414..12a55ba 100644 --- a/src/ecma119_tree.h +++ b/src/ecma119_tree.h @@ -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;