thread: try to keep relative order from input

pull/1/merge
Christian Neukirchen 8 years ago
parent 435d5a5a89
commit 105f520c7e

@ -194,16 +194,15 @@ out:
c->parent = parent; c->parent = parent;
/* // add at the end
not needed with above checks? for (r = parent->child; r && r->next; r = r->next)
for (r = parent->child; r; r = r->next) { ;
// check if we are already a child of the correct parent if (!r) {
if (r == c) parent->child = c;
goto out2; } else {
r->next = c;
c->next = 0;
} }
*/
c->next = parent->child;
parent->child = c;
out2: out2:
// someone said our parent was our child, a lie // someone said our parent was our child, a lie
@ -222,7 +221,7 @@ find_root(const void *nodep, const VISIT which, const int depth)
{ {
(void)depth; (void)depth;
if (which == postorder || which == leaf) { if (which == preorder || which == leaf) {
struct container *c = *(struct container **)nodep; struct container *c = *(struct container **)nodep;
if (!c->parent) { if (!c->parent) {

Loading…
Cancel
Save