From a4b6f559da2af7f1c035446a1ad8f01fd4d9dbf7 Mon Sep 17 00:00:00 2001 From: Katharina Fey Date: Sun, 11 Dec 2016 03:09:14 +0100 Subject: Adding new function that gets the parent of a current node in a recursive structure --- include/dtree/dtree.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include') diff --git a/include/dtree/dtree.h b/include/dtree/dtree.h index 7662412..a315014 100644 --- a/include/dtree/dtree.h +++ b/include/dtree/dtree.h @@ -188,6 +188,19 @@ dt_err dtree_split_trees(dtree *data, dtree *sp); dt_err dtree_merge_trees(dtree *data, dtree *merge); +/** + * You can use this function to search the structure of a root node to find the + * parent of the node you provide as "data". It will leave the search pointer + * blanked if the node can't be found in the structure. + * + * @param root Root reference to search + * @param data The node we are searching for + * @param parent The node parent we are interested in + * @return + */ +dt_err dtree_parent(dtree *root, dtree *data, dtree **parent); + + /** * Recursive tree search function that will return the first occurence match * to a provided payload (with an exact type). If you have data duplication -- cgit v1.2.3