/* ET-trees data structure implementation.
Contributed by Pavel Nejedly
- Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008 Free Software
+ Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2010 Free Software
Foundation, Inc.
This file is part of the libiberty library.
#include "config.h"
#include "system.h"
#include "coretypes.h"
-#include "tm.h"
#include "et-forest.h"
#include "alloc-pool.h"
if (r)
r->parent = o1;
}
- else
+ else if (r == o2 || (r && r->parent != NULL))
{
ret = o2->prev;
if (l)
l->parent = o1;
}
+ else
+ {
+ /* O1 and O2 are in different components of the forest. */
+ if (l)
+ l->parent = o1;
+ if (r)
+ r->parent = o1;
+ return NULL;
+ }
if (0 < o2->depth)
{