diff --git a/src/utils/ufd.c b/src/utils/ufd.c index e74a154..79f0a24 100644 --- a/src/utils/ufd.c +++ b/src/utils/ufd.c @@ -2,24 +2,12 @@ #include "stdlib.h" #include -struct ufd_t ufd__make_set(struct context_entry_t* thread) -{ - struct ufd_children_t children = TAILQ_HEAD_INITIALIZER(children); - - return (struct ufd_t) { - .thread = thread, - .parent = NULL, - .repr = NULL, - .children = children, - }; -} - void ufd__init(struct ufd_t* ufd, struct context_entry_t* thread) { TAILQ_INIT(&ufd->children); ufd->thread = thread; - ufd->repr = NULL, + ufd->repr = ufd, ufd->parent = NULL; } @@ -39,13 +27,9 @@ void ufd__join(struct ufd_t* th1, struct ufd_t* th2) struct ufd_t* ufd__find(struct ufd_t* th) { - if (th->parent == NULL) + if (th->repr == th) return th; - // If parent is null, repr can't be null - if (th->repr->parent == NULL) - return th->repr; - struct ufd_t* nrepr = ufd__find(th->repr); th->repr = nrepr; return nrepr; diff --git a/src/utils/ufd.h b/src/utils/ufd.h index 9ba2d38..c8a8daf 100644 --- a/src/utils/ufd.h +++ b/src/utils/ufd.h @@ -14,8 +14,6 @@ struct ufd_t { }; -struct ufd_t ufd__make_set(struct context_entry_t* thread); - void ufd__init(struct ufd_t* ufd, struct context_entry_t* thread); /*