- xbt_dict_cursor_t cursor = NULL;
- container_t child;
- char *child_name;
- container_t a1_try = NULL;
- container_t a2_try = NULL;
- xbt_dict_foreach(root->children, cursor, child_name, child) {
- a1_try = findChild (child, a1);
- a2_try = findChild (child, a2);
- if (a1_try && a2_try) return child;
+ //find the lowest ancestor of a2 in the previously created array
+ p = a2->father;
+ while (p){
+ int cpt;
+ unsigned int cursor;
+ xbt_dynar_foreach (ancestors, cursor, cpt){
+ container_t pp = *(container_t*)xbt_dynar_get_ptr(ancestors, cursor);
+ if (p == pp){
+ return p;
+ }
+ }
+ p = p->father;