data tree REFACTOR use common union in all data nodes

Also, now redundant casting removed where possible.
Fixes #1388
diff --git a/src/printer_data.c b/src/printer_data.c
index 14bb879..b66511d 100644
--- a/src/printer_data.c
+++ b/src/printer_data.c
@@ -59,7 +59,7 @@
     if (root) {
         /* get first top-level sibling */
         while (root->parent) {
-            root = (struct lyd_node *)root->parent;
+            root = lyd_parent(root);
         }
         while (root->prev->next) {
             root = root->prev;