plugin types REFACTOR remove STORE and CANONIZE flags

The behavior was changed as if both of these
flags are always set. Also, types now always
include their canonical/JSON string value.

Finally, default value resolution was also
refactored to avoid some code duplication.
This change was most evident in deviations,
which were then significantly refactored.
diff --git a/src/printer_lyb.c b/src/printer_lyb.c
index 554d6b4..a99c8dc 100644
--- a/src/printer_lyb.c
+++ b/src/printer_lyb.c
@@ -672,20 +672,8 @@
 static LY_ERR
 lyb_print_term(struct lyd_node_term *term, struct ly_out *out, struct lylyb_ctx *lybctx)
 {
-    LY_ERR ret;
-    int dynamic;
-    const char *str;
-
-    /* get value */
-    str = lyd_value2str(term, &dynamic);
-
-    /* print it */
-    ret = lyb_write_string(str, 0, 0, out, lybctx);
-
-    if (dynamic) {
-        free((char *)str);
-    }
-    return ret;
+    /* print the value */
+    return lyb_write_string(LYD_CANONICAL(term), 0, 0, out, lybctx);
 }
 
 /**
@@ -699,12 +687,9 @@
 static LY_ERR
 lyb_print_metadata(struct ly_out *out, const struct lyd_node *node, struct lyd_lyb_ctx *lybctx)
 {
-    LY_ERR ret;
-    int dynamic;
     uint8_t count = 0;
     const struct lys_module *wd_mod = NULL;
     struct lyd_meta *iter;
-    const char *str;
 
     /* with-defaults */
     if (node->schema->nodetype & LYD_NODE_TERM) {
@@ -750,15 +735,8 @@
         /* annotation name with length */
         LY_CHECK_RET(lyb_write_string(iter->name, 0, 1, out, lybctx->lybctx));
 
-        /* get the value */
-        str = lyd_meta2str(iter, &dynamic);
-
         /* metadata value */
-        ret = lyb_write_string(str, 0, 0, out, lybctx->lybctx);
-        if (dynamic) {
-            free((char *)str);
-        }
-        LY_CHECK_RET(ret);
+        LY_CHECK_RET(lyb_write_string(iter->value.canonical, 0, 0, out, lybctx->lybctx));
 
         /* finish metadata subtree */
         LY_CHECK_RET(lyb_write_stop_subtree(out, lybctx->lybctx));