libyang REFACTOR rename lyd_value.canonical to lyd_value._canonical

Express the fact the member is not supposed to be used directly.
diff --git a/src/plugins_types.c b/src/plugins_types.c
index 98c4b15..5493c98 100644
--- a/src/plugins_types.c
+++ b/src/plugins_types.c
@@ -274,7 +274,7 @@
         return LY_ENOT;
     }
 
-    if (val1->canonical == val2->canonical) {
+    if (val1->_canonical == val2->_canonical) {
         return LY_SUCCESS;
     }
 
@@ -289,15 +289,15 @@
         *dynamic = 0;
     }
     if (value_len) {
-        *value_len = strlen(value->canonical);
+        *value_len = strlen(value->_canonical);
     }
-    return value->canonical;
+    return value->_canonical;
 }
 
 API LY_ERR
 lyplg_type_dup_simple(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup)
 {
-    LY_CHECK_RET(lydict_insert(ctx, original->canonical, strlen(original->canonical), &dup->canonical));
+    LY_CHECK_RET(lydict_insert(ctx, original->_canonical, strlen(original->_canonical), &dup->_canonical));
     dup->ptr = original->ptr;
     dup->realtype = original->realtype;
     return LY_SUCCESS;
@@ -306,8 +306,8 @@
 API void
 lyplg_type_free_simple(const struct ly_ctx *ctx, struct lyd_value *value)
 {
-    lydict_remove(ctx, value->canonical);
-    value->canonical = NULL;
+    lydict_remove(ctx, value->_canonical);
+    value->_canonical = NULL;
 }
 
 API LY_ERR
diff --git a/src/plugins_types.h b/src/plugins_types.h
index dc661b2..9b1ac71 100644
--- a/src/plugins_types.h
+++ b/src/plugins_types.h
@@ -72,7 +72,7 @@
  * provided string representation of the value in specified format (XML and JSON supported). Valid value is stored in
  * ::lyd_value structure - its union allows to store data as one of the predefined type or in a custom form behind
  * the void *ptr member of ::lyd_value structure. The callback is also responsible for storing canonized string
- * representation of the value as ::lyd_value.canonical. If the type does not define canonical representation, the original
+ * representation of the value as ::lyd_value._canonical. If the type does not define canonical representation, the original
  * representation is stored. In case there are any differences between the representation in specific input types, the plugin
  * is supposed to store the value in JSON representation - typically, the difference is in prefix representation and JSON
  * format uses directly the module names as prefixes.
@@ -85,7 +85,7 @@
  * the values is to compare their canonical string representations, the ::lyplg_type_compare_simple() function can be used.
  *
  * Data duplication is done with ::lyplg_type_dup_clb callbacks. Note that the callback is responsible even for duplicating
- * the ::lyd_value.canonical, so the callback must be always present (the canonical value is always present). If there is
+ * the ::lyd_value._canonical, so the callback must be always present (the canonical value is always present). If there is
  * nothing else to duplicate, the plugin can use the generic ::lyplg_type_dup_simple().
  *
  * The stored value can be printed into the required format via ::lyplg_type_print_clb implementation. Simple printing
@@ -352,7 +352,7 @@
  * @brief Callback to store the given @p value according to the given @p type.
  *
  * Value must always be correctly stored meaning all the other type callbacks (such as print or compare)
- * must function as expected. However, ::lyd_value.canonical can be left NULL and will be generated
+ * must function as expected. However, ::lyd_value._canonical can be left NULL and will be generated
  * and stored on-demand. But if @p format is ::LY_VALUE_CANON (or another, which must be equal to the canonical
  * value), the canonical value should be stored so that it does not have to be generated later.
  *
@@ -369,7 +369,7 @@
  * @param[in] prefix_data Format-specific data for resolving any prefixes (see ly_resolve_prefix()).
  * @param[in] hints Bitmap of [value hints](@ref lydvalhints) of all the allowed value types.
  * @param[in] ctx_node Schema context node of @p value.
- * @param[out] storage Storage for the value in the type's specific encoding. Except for canonical, all the members
+ * @param[out] storage Storage for the value in the type's specific encoding. Except for _canonical, all the members
  * should be filled by the plugin (if it fills them at all).
  * @param[in,out] unres Global unres structure for newly implemented modules.
  * @param[out] err Optionally provided error information in case of failure. If not provided to the caller, a generic
@@ -498,7 +498,7 @@
  * @{
  *
  * Simple functions implementing @ref howtoPluginsTypes callbacks handling simply just the canonical string of the value
- * (::lyd_value.canonical).
+ * (::lyd_value._canonical).
  */
 
 /**
@@ -521,7 +521,7 @@
 LY_ERR lyplg_type_dup_simple(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup);
 
 /**
- * @brief Generic cleanup callback freeing only the canonized value in ::lyd_value.canonical.
+ * @brief Generic cleanup callback freeing only the canonized value in ::lyd_value._canonical.
  * Simple implementation of the ::lyplg_type_free_clb.
  */
 void lyplg_type_free_simple(const struct ly_ctx *ctx, struct lyd_value *value);
diff --git a/src/plugins_types/binary.c b/src/plugins_types/binary.c
index 8c23d64..0a18d83 100644
--- a/src/plugins_types/binary.c
+++ b/src/plugins_types/binary.c
@@ -109,10 +109,10 @@
     }
 
     if (base64_count != 0) {
-        ret = lydict_insert(ctx, &value[base64_start], base64_end - base64_start, &storage->canonical);
+        ret = lydict_insert(ctx, &value[base64_start], base64_end - base64_start, &storage->_canonical);
         LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
     } else {
-        ret = lydict_insert(ctx, "", 0, &storage->canonical);
+        ret = lydict_insert(ctx, "", 0, &storage->_canonical);
         LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
     }
     storage->ptr = NULL;
diff --git a/src/plugins_types/bits.c b/src/plugins_types/bits.c
index 7f51f13..ca2d3cc 100644
--- a/src/plugins_types/bits.c
+++ b/src/plugins_types/bits.c
@@ -152,12 +152,12 @@
         }
         buf[buf_index] = 0;
 
-        ret = lydict_insert_zc(ctx, buf, &storage->canonical);
+        ret = lydict_insert_zc(ctx, buf, &storage->_canonical);
         buf = NULL;
         LY_CHECK_GOTO(ret, cleanup);
     } else {
         bits_items = NULL;
-        ret = lydict_insert(ctx, "", 0, &storage->canonical);
+        ret = lydict_insert(ctx, "", 0, &storage->_canonical);
         buf = NULL;
         LY_CHECK_GOTO(ret, cleanup);
     }
@@ -199,7 +199,7 @@
         bits_items[u] = original->bits_items[u];
     }
 
-    ret = lydict_insert(ctx, original->canonical, strlen(original->canonical), &dup->canonical);
+    ret = lydict_insert(ctx, original->_canonical, strlen(original->_canonical), &dup->_canonical);
     LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
     dup->bits_items = bits_items;
     dup->realtype = original->realtype;
@@ -217,8 +217,8 @@
     LY_ARRAY_FREE(value->bits_items);
     value->bits_items = NULL;
 
-    lydict_remove(ctx, value->canonical);
-    value->canonical = NULL;
+    lydict_remove(ctx, value->_canonical);
+    value->_canonical = NULL;
 }
 
 /**
diff --git a/src/plugins_types/boolean.c b/src/plugins_types/boolean.c
index c3c9924..a212bf8 100644
--- a/src/plugins_types/boolean.c
+++ b/src/plugins_types/boolean.c
@@ -53,11 +53,11 @@
     }
 
     if (options & LYPLG_TYPE_STORE_DYNAMIC) {
-        ret = lydict_insert_zc(ctx, (char *)value, &storage->canonical);
+        ret = lydict_insert_zc(ctx, (char *)value, &storage->_canonical);
         options &= ~LYPLG_TYPE_STORE_DYNAMIC;
         LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
     } else {
-        ret = lydict_insert(ctx, value, value_len, &storage->canonical);
+        ret = lydict_insert(ctx, value, value_len, &storage->_canonical);
         LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
     }
     storage->boolean = i;
diff --git a/src/plugins_types/date_and_time.c b/src/plugins_types/date_and_time.c
index 45f1791..ab89092 100644
--- a/src/plugins_types/date_and_time.c
+++ b/src/plugins_types/date_and_time.c
@@ -113,46 +113,46 @@
     /* canonize */
     /* \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[\+\-]\d{2}:\d{2})
      * 2018-03-21T09:11:05(.55785...)(Z|+02:00) */
-    val_str = storage->canonical;
+    val_str = storage->_canonical;
 
     /* year */
-    ret = convert_number(&val_str, 4, storage->canonical, &tm.tm_year, err);
+    ret = convert_number(&val_str, 4, storage->_canonical, &tm.tm_year, err);
     LY_CHECK_GOTO(ret, cleanup);
     tm.tm_year -= 1900;
 
-    LY_CHECK_GOTO(ret = check_char(&val_str, "-", storage->canonical, err), cleanup);
+    LY_CHECK_GOTO(ret = check_char(&val_str, "-", storage->_canonical, err), cleanup);
 
     /* month */
-    ret = convert_number(&val_str, 2, storage->canonical, &tm.tm_mon, err);
+    ret = convert_number(&val_str, 2, storage->_canonical, &tm.tm_mon, err);
     LY_CHECK_GOTO(ret, cleanup);
     tm.tm_mon -= 1;
 
-    LY_CHECK_GOTO(ret = check_char(&val_str, "-", storage->canonical, err), cleanup);
+    LY_CHECK_GOTO(ret = check_char(&val_str, "-", storage->_canonical, err), cleanup);
 
     /* day */
-    ret = convert_number(&val_str, 2, storage->canonical, &tm.tm_mday, err);
+    ret = convert_number(&val_str, 2, storage->_canonical, &tm.tm_mday, err);
     LY_CHECK_GOTO(ret, cleanup);
 
-    LY_CHECK_GOTO(ret = check_char(&val_str, "T", storage->canonical, err), cleanup);
+    LY_CHECK_GOTO(ret = check_char(&val_str, "T", storage->_canonical, err), cleanup);
 
     /* hours */
-    ret = convert_number(&val_str, 2, storage->canonical, &tm.tm_hour, err);
+    ret = convert_number(&val_str, 2, storage->_canonical, &tm.tm_hour, err);
     LY_CHECK_GOTO(ret, cleanup);
 
-    LY_CHECK_GOTO(ret = check_char(&val_str, ":", storage->canonical, err), cleanup);
+    LY_CHECK_GOTO(ret = check_char(&val_str, ":", storage->_canonical, err), cleanup);
 
     /* minutes */
-    ret = convert_number(&val_str, 2, storage->canonical, &tm.tm_min, err);
+    ret = convert_number(&val_str, 2, storage->_canonical, &tm.tm_min, err);
     LY_CHECK_GOTO(ret, cleanup);
 
-    LY_CHECK_GOTO(ret = check_char(&val_str, ":", storage->canonical, err), cleanup);
+    LY_CHECK_GOTO(ret = check_char(&val_str, ":", storage->_canonical, err), cleanup);
 
     /* seconds */
-    ret = convert_number(&val_str, 2, storage->canonical, &tm.tm_sec, err);
+    ret = convert_number(&val_str, 2, storage->_canonical, &tm.tm_sec, err);
     LY_CHECK_GOTO(ret, cleanup);
 
     /* do not move the pointer */
-    LY_CHECK_GOTO(ret = check_char(&val_str, ".Z+-", storage->canonical, err), cleanup);
+    LY_CHECK_GOTO(ret = check_char(&val_str, ".Z+-", storage->_canonical, err), cleanup);
     --val_str;
 
     /* validate using mktime() */
@@ -162,7 +162,7 @@
     /* ENOENT is set when "/etc/localtime" is missing but the function suceeeds */
     if (errno && (errno != ENOENT)) {
         ret = ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, NULL, "Checking date-and-time value \"%s\" failed (%s).",
-                storage->canonical, strerror(errno));
+                storage->_canonical, strerror(errno));
         goto cleanup;
     }
     /* we now have correctly filled the remaining values, use them */
@@ -174,13 +174,13 @@
     mktime(&tm);
     if (errno && (errno != ENOENT)) {
         ret = ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, NULL, "Checking date-and-time value \"%s\" failed (%s).",
-                storage->canonical, strerror(errno));
+                storage->_canonical, strerror(errno));
         goto cleanup;
     }
     /* detect changes in the filled values */
     if (memcmp(&tm, &tm2, 6 * sizeof(int))) {
         ret = ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, NULL, "Checking date-and-time value \"%s\" failed, "
-                "canonical date and time is \"%04d-%02d-%02dT%02d:%02d:%02d\".", storage->canonical,
+                "canonical date and time is \"%04d-%02d-%02dT%02d:%02d:%02d\".", storage->_canonical,
                 tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
         goto cleanup;
     }
@@ -188,7 +188,7 @@
     /* tenth of a second */
     if (val_str[0] == '.') {
         ++val_str;
-        ret = convert_number(&val_str, 0, storage->canonical, &num, err);
+        ret = convert_number(&val_str, 0, storage->_canonical, &num, err);
         LY_CHECK_GOTO(ret, cleanup);
     }
 
@@ -202,42 +202,42 @@
         /* timezone shift */
         if ((val_str[1] < '0') || (val_str[1] > '2')) {
             ret = ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, NULL, "Invalid timezone \"%.6s\" in date-and-time value \"%s\".",
-                    val_str, storage->canonical);
+                    val_str, storage->_canonical);
             goto cleanup;
         }
         if ((val_str[2] < '0') || ((val_str[1] == '2') && (val_str[2] > '3')) || (val_str[2] > '9')) {
             ret = ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, NULL, "Invalid timezone \"%.6s\" in date-and-time value \"%s\".",
-                    val_str, storage->canonical);
+                    val_str, storage->_canonical);
             goto cleanup;
         }
 
         if (val_str[3] != ':') {
             ret = ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, NULL, "Invalid timezone \"%.6s\" in date-and-time value \"%s\".",
-                    val_str, storage->canonical);
+                    val_str, storage->_canonical);
             goto cleanup;
         }
 
         if ((val_str[4] < '0') || (val_str[4] > '5')) {
             ret = ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, NULL, "Invalid timezone \"%.6s\" in date-and-time value \"%s\".",
-                    val_str, storage->canonical);
+                    val_str, storage->_canonical);
             goto cleanup;
         }
         if ((val_str[5] < '0') || (val_str[5] > '9')) {
             ret = ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, NULL, "Invalid timezone \"%.6s\" in date-and-time value \"%s\".",
-                    val_str, storage->canonical);
+                    val_str, storage->_canonical);
             goto cleanup;
         }
 
         val_str += 6;
         break;
     default:
-        LY_CHECK_GOTO(ret = check_char(&val_str, "Z+-", storage->canonical, err), cleanup);
+        LY_CHECK_GOTO(ret = check_char(&val_str, "Z+-", storage->_canonical, err), cleanup);
     }
 
     /* no other characters expected */
     if (val_str[0]) {
         ret = ly_err_new(err, LY_EVALID, LYVE_DATA, NULL, NULL, "Invalid character '%c' in date-and-time value \"%s\", "
-                "no characters expected.", val_str[0], storage->canonical);
+                "no characters expected.", val_str[0], storage->_canonical);
         goto cleanup;
     }
 
diff --git a/src/plugins_types/decimal64.c b/src/plugins_types/decimal64.c
index 0e5eb59..9ac33c5 100644
--- a/src/plugins_types/decimal64.c
+++ b/src/plugins_types/decimal64.c
@@ -86,7 +86,7 @@
         LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
     }
 
-    ret = lydict_insert(ctx, buf, strlen(buf), &storage->canonical);
+    ret = lydict_insert(ctx, buf, strlen(buf), &storage->_canonical);
     LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
     storage->dec64 = d;
     storage->realtype = type;
diff --git a/src/plugins_types/empty.c b/src/plugins_types/empty.c
index 7c91048..27ea094 100644
--- a/src/plugins_types/empty.c
+++ b/src/plugins_types/empty.c
@@ -47,11 +47,11 @@
     }
 
     if (options & LYPLG_TYPE_STORE_DYNAMIC) {
-        ret = lydict_insert_zc(ctx, (char *)value, &storage->canonical);
+        ret = lydict_insert_zc(ctx, (char *)value, &storage->_canonical);
         options &= ~LYPLG_TYPE_STORE_DYNAMIC;
         LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
     } else {
-        ret = lydict_insert(ctx, "", value_len, &storage->canonical);
+        ret = lydict_insert(ctx, "", value_len, &storage->_canonical);
         LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
     }
     storage->ptr = NULL;
diff --git a/src/plugins_types/enumeration.c b/src/plugins_types/enumeration.c
index 04e1af2..bdb3c65 100644
--- a/src/plugins_types/enumeration.c
+++ b/src/plugins_types/enumeration.c
@@ -58,11 +58,11 @@
     /* validation done */
 
     if (options & LYPLG_TYPE_STORE_DYNAMIC) {
-        ret = lydict_insert_zc(ctx, (char *)value, &storage->canonical);
+        ret = lydict_insert_zc(ctx, (char *)value, &storage->_canonical);
         options &= ~LYPLG_TYPE_STORE_DYNAMIC;
         LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
     } else {
-        ret = lydict_insert(ctx, value_len ? value : "", value_len, &storage->canonical);
+        ret = lydict_insert(ctx, value_len ? value : "", value_len, &storage->_canonical);
         LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
     }
     storage->enum_item = &type_enum->enums[u];
diff --git a/src/plugins_types/hex_string.c b/src/plugins_types/hex_string.c
index 356f9d2..b28b7d3 100644
--- a/src/plugins_types/hex_string.c
+++ b/src/plugins_types/hex_string.c
@@ -46,7 +46,7 @@
             storage, unres, err);
     LY_CHECK_RET(ret);
 
-    str = strdup(storage->canonical);
+    str = strdup(storage->_canonical);
     if (!str) {
         /* we can hardly allocate an error message */
         ret = LY_EMEM;
@@ -62,9 +62,9 @@
     }
 
     /* update the value correctly */
-    lydict_remove(ctx, storage->canonical);
-    storage->canonical = NULL;
-    LY_CHECK_GOTO(ret = lydict_insert_zc(ctx, str, &storage->canonical), cleanup);
+    lydict_remove(ctx, storage->_canonical);
+    storage->_canonical = NULL;
+    LY_CHECK_GOTO(ret = lydict_insert_zc(ctx, str, &storage->_canonical), cleanup);
 
     /* validation succeeded and we do not want to change how it is stored */
 
diff --git a/src/plugins_types/identityref.c b/src/plugins_types/identityref.c
index a26ed18..849720b 100644
--- a/src/plugins_types/identityref.c
+++ b/src/plugins_types/identityref.c
@@ -147,7 +147,7 @@
 
     /* get JSON form since there is no canonical */
     str = identityref_print(storage, LY_VALUE_JSON, NULL);
-    ret = lydict_insert_zc(ctx, str, &storage->canonical);
+    ret = lydict_insert_zc(ctx, str, &storage->_canonical);
     LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
     storage->realtype = type;
 
@@ -170,9 +170,9 @@
             *dynamic = 0;
         }
         if (value_len) {
-            *value_len = strlen(value->canonical);
+            *value_len = strlen(value->_canonical);
         }
-        return value->canonical;
+        return value->_canonical;
     }
 
     result = identityref_print(value, format, prefix_data);
diff --git a/src/plugins_types/instanceid.c b/src/plugins_types/instanceid.c
index 789afb9..8aca701 100644
--- a/src/plugins_types/instanceid.c
+++ b/src/plugins_types/instanceid.c
@@ -93,7 +93,7 @@
         *dynamic = 1;
     } else if ((format == LY_VALUE_CANON) || (format == LY_VALUE_JSON)) {
         /* generate canonical, only the first node or the node changing module is prefixed */
-        if (!value->canonical) {
+        if (!value->_canonical) {
             struct lys_module *mod = NULL;
             LY_ARRAY_FOR(value->target, u) {
                 if (mod != value->target[u].node->module) {
@@ -144,11 +144,11 @@
                 }
             }
 
-            lydict_insert_zc(ctx, result, (const char **)&value->canonical);
+            lydict_insert_zc(ctx, result, (const char **)&value->_canonical);
         }
 
         /* use canonical */
-        result = (char *)value->canonical;
+        result = (char *)value->_canonical;
         if (dynamic) {
             *dynamic = 0;
         }
@@ -292,7 +292,7 @@
 API LY_ERR
 lyplg_type_dup_instanceid(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup)
 {
-    LY_CHECK_RET(lydict_insert(ctx, original->canonical, strlen(original->canonical), &dup->canonical));
+    LY_CHECK_RET(lydict_insert(ctx, original->_canonical, strlen(original->_canonical), &dup->_canonical));
     dup->realtype = original->realtype;
     return ly_path_dup(ctx, original->target, &dup->target);
 }
diff --git a/src/plugins_types/integer.c b/src/plugins_types/integer.c
index 977010b..2d8d424 100644
--- a/src/plugins_types/integer.c
+++ b/src/plugins_types/integer.c
@@ -73,7 +73,7 @@
     }
 
     /* store everything */
-    ret = lydict_insert_zc(ctx, str, &storage->canonical);
+    ret = lydict_insert_zc(ctx, str, &storage->_canonical);
     LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
 
     /* matters for big-endian */
@@ -146,7 +146,7 @@
     }
 
     /* store everything */
-    ret = lydict_insert_zc(ctx, str, &storage->canonical);
+    ret = lydict_insert_zc(ctx, str, &storage->_canonical);
     LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
 
     /* matters for big-endian */
diff --git a/src/plugins_types/ip_address.c b/src/plugins_types/ip_address.c
index 3e14819..7ee0d5d 100644
--- a/src/plugins_types/ip_address.c
+++ b/src/plugins_types/ip_address.c
@@ -81,13 +81,13 @@
             storage, unres, err);
     LY_CHECK_RET(ret);
 
-    if (strchr(storage->canonical, ':')) {
+    if (strchr(storage->_canonical, ':')) {
         /* canonize IPv6 address */
-        if ((ptr = strchr(storage->canonical, '%'))) {
+        if ((ptr = strchr(storage->_canonical, '%'))) {
             /* there is a zone index */
-            ipv6_addr = strndup(storage->canonical, ptr - storage->canonical);
+            ipv6_addr = strndup(storage->_canonical, ptr - storage->_canonical);
         } else {
-            ipv6_addr = (char *)storage->canonical;
+            ipv6_addr = (char *)storage->_canonical;
         }
 
         /* convert to canonical format */
@@ -97,7 +97,7 @@
         }
         LY_CHECK_GOTO(ret, cleanup);
 
-        if (strncmp(storage->canonical, result, strlen(result))) {
+        if (strncmp(storage->_canonical, result, strlen(result))) {
             /* some conversion took place */
             if (ptr) {
                 /* concatenate the zone, if any */
@@ -111,9 +111,9 @@
             }
 
             /* update the value */
-            lydict_remove(ctx, storage->canonical);
-            storage->canonical = NULL;
-            LY_CHECK_GOTO(ret = lydict_insert_zc(ctx, result, &storage->canonical), cleanup);
+            lydict_remove(ctx, storage->_canonical);
+            storage->_canonical = NULL;
+            LY_CHECK_GOTO(ret = lydict_insert_zc(ctx, result, &storage->_canonical), cleanup);
         } else {
             free(result);
         }
diff --git a/src/plugins_types/ip_prefix.c b/src/plugins_types/ip_prefix.c
index 1ecdb1a..124a31d 100644
--- a/src/plugins_types/ip_prefix.c
+++ b/src/plugins_types/ip_prefix.c
@@ -206,14 +206,14 @@
     LY_CHECK_RET(ret);
 
     /* canonize */
-    ret = canonize_ipv4_prefix(storage->canonical, &canonical, err);
+    ret = canonize_ipv4_prefix(storage->_canonical, &canonical, err);
     LY_CHECK_GOTO(ret, cleanup);
 
-    if (strcmp(canonical, storage->canonical)) {
+    if (strcmp(canonical, storage->_canonical)) {
         /* some conversion took place, update the value */
-        lydict_remove(ctx, storage->canonical);
-        storage->canonical = NULL;
-        LY_CHECK_GOTO(ret = lydict_insert_zc(ctx, canonical, &storage->canonical), cleanup);
+        lydict_remove(ctx, storage->_canonical);
+        storage->_canonical = NULL;
+        LY_CHECK_GOTO(ret = lydict_insert_zc(ctx, canonical, &storage->_canonical), cleanup);
     } else {
         free(canonical);
     }
@@ -243,14 +243,14 @@
     LY_CHECK_RET(ret);
 
     /* canonize */
-    ret = canonize_ipv6_prefix(storage->canonical, &canonical, err);
+    ret = canonize_ipv6_prefix(storage->_canonical, &canonical, err);
     LY_CHECK_GOTO(ret, cleanup);
 
-    if (strcmp(canonical, storage->canonical)) {
+    if (strcmp(canonical, storage->_canonical)) {
         /* some conversion took place, update the value */
-        lydict_remove(ctx, storage->canonical);
-        storage->canonical = NULL;
-        LY_CHECK_GOTO(ret = lydict_insert_zc(ctx, canonical, &storage->canonical), cleanup);
+        lydict_remove(ctx, storage->_canonical);
+        storage->_canonical = NULL;
+        LY_CHECK_GOTO(ret = lydict_insert_zc(ctx, canonical, &storage->_canonical), cleanup);
     } else {
         free(canonical);
     }
diff --git a/src/plugins_types/string.c b/src/plugins_types/string.c
index 1223fe7..225a2c4 100644
--- a/src/plugins_types/string.c
+++ b/src/plugins_types/string.c
@@ -56,11 +56,11 @@
     LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
 
     if (options & LYPLG_TYPE_STORE_DYNAMIC) {
-        ret = lydict_insert_zc(ctx, (char *)value, &storage->canonical);
+        ret = lydict_insert_zc(ctx, (char *)value, &storage->_canonical);
         options &= ~LYPLG_TYPE_STORE_DYNAMIC;
         LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
     } else {
-        ret = lydict_insert(ctx, value_len ? value : "", value_len, &storage->canonical);
+        ret = lydict_insert(ctx, value_len ? value : "", value_len, &storage->_canonical);
         LY_CHECK_GOTO(ret != LY_SUCCESS, cleanup);
     }
     storage->ptr = NULL;
diff --git a/src/plugins_types/union.c b/src/plugins_types/union.c
index bbe8987..118def6 100644
--- a/src/plugins_types/union.c
+++ b/src/plugins_types/union.c
@@ -126,7 +126,7 @@
         free(subvalue);
     } else {
         /* store it as union, the specific type is in the subvalue, but canonical value is the specific type value */
-        ret = lydict_insert(ctx, subvalue->value.canonical, 0, &storage->canonical);
+        ret = lydict_insert(ctx, subvalue->value._canonical, 0, &storage->_canonical);
         LY_CHECK_GOTO(ret, cleanup);
         storage->subvalue = subvalue;
         storage->realtype = type;
@@ -173,8 +173,8 @@
     LY_CHECK_RET(ret);
 
     /* success, update the canonical value */
-    lydict_remove(ctx, storage->canonical);
-    LY_CHECK_RET(lydict_insert(ctx, subvalue->value.canonical, 0, &storage->canonical));
+    lydict_remove(ctx, storage->_canonical);
+    LY_CHECK_RET(lydict_insert(ctx, subvalue->value._canonical, 0, &storage->_canonical));
     return LY_SUCCESS;
 }
 
@@ -198,9 +198,9 @@
     const void *ret;
 
     ret = value->subvalue->value.realtype->plugin->print(ctx, &value->subvalue->value, format, prefix_data, dynamic, value_len);
-    if (!value->canonical && (format == LY_VALUE_CANON)) {
+    if (!value->_canonical && (format == LY_VALUE_CANON)) {
         /* the canonical value is supposed to be stored now */
-        lydict_insert(ctx, value->subvalue->value.canonical, 0, (const char **)&value->canonical);
+        lydict_insert(ctx, value->subvalue->value._canonical, 0, (const char **)&value->_canonical);
     }
 
     return ret;
@@ -209,7 +209,7 @@
 API LY_ERR
 lyplg_type_dup_union(const struct ly_ctx *ctx, const struct lyd_value *original, struct lyd_value *dup)
 {
-    LY_CHECK_RET(lydict_insert(ctx, original->canonical, strlen(original->canonical), &dup->canonical));
+    LY_CHECK_RET(lydict_insert(ctx, original->_canonical, strlen(original->_canonical), &dup->_canonical));
 
     dup->subvalue = calloc(1, sizeof *dup->subvalue);
     LY_CHECK_ERR_RET(!dup->subvalue, LOGMEM(ctx), LY_EMEM);
@@ -228,7 +228,7 @@
 API void
 lyplg_type_free_union(const struct ly_ctx *ctx, struct lyd_value *value)
 {
-    lydict_remove(ctx, value->canonical);
+    lydict_remove(ctx, value->_canonical);
     if (value->subvalue) {
         if (value->subvalue->value.realtype) {
             value->subvalue->value.realtype->plugin->free(ctx, &value->subvalue->value);
diff --git a/src/plugins_types/xpath1.0.c b/src/plugins_types/xpath1.0.c
index d08b1f5..b30ac4c 100644
--- a/src/plugins_types/xpath1.0.c
+++ b/src/plugins_types/xpath1.0.c
@@ -216,13 +216,13 @@
     storage->ptr = xp_val;
 
     /* store format-specific data and context for later prefix resolution */
-    ret = lyplg_type_prefix_data_new(ctx, storage->canonical, strlen(storage->canonical), format, prefix_data,
+    ret = lyplg_type_prefix_data_new(ctx, storage->_canonical, strlen(storage->_canonical), format, prefix_data,
             &xp_val->format, &xp_val->prefix_data);
     LY_CHECK_GOTO(ret, cleanup);
     xp_val->ctx = ctx;
 
     /* parse */
-    ret = lyxp_expr_parse(ctx, storage->canonical, strlen(storage->canonical), 1, &xp_val->exp);
+    ret = lyxp_expr_parse(ctx, storage->_canonical, strlen(storage->_canonical), 1, &xp_val->exp);
     LY_CHECK_GOTO(ret, cleanup);
 
     if (format != LY_VALUE_JSON) {
@@ -231,9 +231,9 @@
         LY_CHECK_GOTO(ret, cleanup);
 
         /* replace the canonical value */
-        lydict_remove(ctx, storage->canonical);
-        storage->canonical = NULL;
-        LY_CHECK_GOTO(ret = lydict_insert_zc(ctx, canonical, &storage->canonical), cleanup);
+        lydict_remove(ctx, storage->_canonical);
+        storage->_canonical = NULL;
+        LY_CHECK_GOTO(ret = lydict_insert_zc(ctx, canonical, &storage->_canonical), cleanup);
     }
 
 cleanup:
@@ -256,9 +256,9 @@
             *dynamic = 0;
         }
         if (value_len) {
-            *value_len = strlen(value->canonical);
+            *value_len = strlen(value->_canonical);
         }
-        return value->canonical;
+        return value->_canonical;
     }
 
     if (xpath10_print_value(value->ptr, format, prefix_data, &str_value, &err)) {
@@ -284,7 +284,7 @@
     memset(dup, 0, sizeof *dup);
     dup->realtype = original->realtype;
 
-    ret = lydict_insert(ctx, original->canonical, 0, &dup->canonical);
+    ret = lydict_insert(ctx, original->_canonical, 0, &dup->_canonical);
     LY_CHECK_GOTO(ret, cleanup);
 
     xp_val = calloc(1, sizeof *xp_val);
@@ -311,7 +311,7 @@
 {
     struct lyd_value_xpath10 *xp_val = value->ptr;
 
-    lydict_remove(ctx, value->canonical);
+    lydict_remove(ctx, value->_canonical);
     if (xp_val) {
         lyxp_expr_free(ctx, xp_val->exp);
         lyplg_type_prefix_data_free(xp_val->format, xp_val->prefix_data);
diff --git a/src/tree_data.h b/src/tree_data.h
index 15b09ef..3792439 100644
--- a/src/tree_data.h
+++ b/src/tree_data.h
@@ -502,7 +502,7 @@
  * @brief YANG data representation
  */
 struct lyd_value {
-    const char *canonical;           /**< Should never be accessed directly, instead ::lyd_get_value() and ::lyd_get_meta_value()
+    const char *_canonical;          /**< Should never be accessed directly, instead ::lyd_get_value() and ::lyd_get_meta_value()
                                           should be used. Serves as a cache for the canonical value or the JSON
                                           representation if no canonical value is defined. */
 
diff --git a/src/tree_data_helpers.c b/src/tree_data_helpers.c
index e4dc1df..1d6c0f0 100644
--- a/src/tree_data_helpers.c
+++ b/src/tree_data_helpers.c
@@ -267,7 +267,7 @@
         return ((struct lyd_node_opaq *)node)->value;
     } else if (node->schema->nodetype & LYD_NODE_TERM) {
         const struct lyd_value *val = &((struct lyd_node_term *)node)->value;
-        return val->canonical ? val->canonical :
+        return val->_canonical ? val->_canonical :
                val->realtype->plugin->print(LYD_CTX(node), val, LY_VALUE_CANON, NULL, NULL, NULL);
     }
     return NULL;
@@ -280,7 +280,7 @@
         return NULL;
     }
 
-    return meta->value.canonical ? meta->value.canonical :
+    return meta->value._canonical ? meta->value._canonical :
            meta->value.realtype->plugin->print(meta->annotation->module->ctx, &meta->value, LY_VALUE_CANON, NULL, NULL, NULL);
 }
 
diff --git a/tests/utests/schema/test_tree_schema_compile.c b/tests/utests/schema/test_tree_schema_compile.c
index 2423ff0..6256036 100644
--- a/tests/utests/schema/test_tree_schema_compile.c
+++ b/tests/utests/schema/test_tree_schema_compile.c
@@ -2846,13 +2846,13 @@
     assert_non_null(leaf = (struct lysc_node_leaf *)mod->compiled->data);
     assert_int_equal(LY_TYPE_STRING, leaf->dflt->realtype->basetype);
     assert_non_null(leaf->dflt->realtype->plugin->print(UTEST_LYCTX, leaf->dflt, LY_VALUE_CANON, NULL, NULL, NULL));
-    assert_string_equal("/e:d2[.='a']", leaf->dflt->canonical);
+    assert_string_equal("/e:d2[.='a']", leaf->dflt->_canonical);
     assert_non_null(llist = (struct lysc_node_leaflist *)leaf->next);
     assert_int_equal(2, LY_ARRAY_COUNT(llist->dflts));
     assert_int_equal(LY_TYPE_STRING, llist->dflts[0]->realtype->basetype);
-    assert_string_equal("/e:d[.='b']", llist->dflts[0]->canonical);
+    assert_string_equal("/e:d[.='b']", llist->dflts[0]->_canonical);
     assert_int_equal(LY_TYPE_STRING, llist->dflts[0]->realtype->basetype);
-    assert_string_equal("/e:d2[.='c']", llist->dflts[1]->canonical);
+    assert_string_equal("/e:d2[.='c']", llist->dflts[1]->_canonical);
 
     assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, "module r {yang-version 1.1; namespace urn:r;prefix r;"
             "typedef mytype {type uint8; default 200;}"
diff --git a/tests/utests/utests.h b/tests/utests/utests.h
index 0e89a02..9be12c3 100644
--- a/tests/utests/utests.h
+++ b/tests/utests/utests.h
@@ -890,7 +890,7 @@
  */
 #define CHECK_LYD_VALUE_EMPTY(NODE, CANNONICAL_VAL) \
     assert_non_null((NODE).realtype->plugin->print(UTEST_LYCTX, &(NODE), LY_VALUE_CANON, NULL, NULL, NULL)); \
-    assert_string_equal((NODE).canonical, CANNONICAL_VAL); \
+    assert_string_equal((NODE)._canonical, CANNONICAL_VAL); \
     assert_non_null((NODE).realtype); \
     assert_int_equal((NODE).realtype->basetype, LY_TYPE_EMPTY);
 
@@ -907,7 +907,7 @@
  */
 #define CHECK_LYD_VALUE_UNION(NODE, CANNONICAL_VAL, TYPE_VAL, ...) \
     assert_non_null((NODE).realtype->plugin->print(UTEST_LYCTX, &(NODE), LY_VALUE_CANON, NULL, NULL, NULL)); \
-    assert_string_equal((NODE).canonical, CANNONICAL_VAL); \
+    assert_string_equal((NODE)._canonical, CANNONICAL_VAL); \
     assert_non_null((NODE).realtype); \
     assert_int_equal(LY_TYPE_UNION, (NODE).realtype->basetype); \
     assert_non_null((NODE).subvalue); \
@@ -923,7 +923,7 @@
  */
 #define CHECK_LYD_VALUE_BITS(NODE, CANNONICAL_VAL, ...) \
     assert_non_null((NODE).realtype->plugin->print(UTEST_LYCTX, &(NODE), LY_VALUE_CANON, NULL, NULL, NULL)); \
-    assert_string_equal((NODE).canonical, CANNONICAL_VAL); \
+    assert_string_equal((NODE)._canonical, CANNONICAL_VAL); \
     assert_non_null((NODE).realtype); \
     assert_int_equal(LY_TYPE_BITS, (NODE).realtype->basetype); \
     { \
@@ -944,7 +944,7 @@
  */
 #define CHECK_LYD_VALUE_INST(NODE, CANNONICAL_VAL, VALUE) \
     assert_non_null((NODE).realtype->plugin->print(UTEST_LYCTX, &(NODE), LY_VALUE_CANON, NULL, NULL, NULL)); \
-    assert_string_equal((NODE).canonical, CANNONICAL_VAL); \
+    assert_string_equal((NODE)._canonical, CANNONICAL_VAL); \
     assert_non_null((NODE).realtype); \
     assert_int_equal(LY_TYPE_INST, (NODE).realtype->basetype); \
     { \
@@ -964,7 +964,7 @@
  */
 #define CHECK_LYD_VALUE_ENUM(NODE, CANNONICAL_VAL, VALUE) \
     assert_non_null((NODE).realtype->plugin->print(UTEST_LYCTX, &(NODE), LY_VALUE_CANON, NULL, NULL, NULL)); \
-    assert_string_equal((NODE).canonical, CANNONICAL_VAL); \
+    assert_string_equal((NODE)._canonical, CANNONICAL_VAL); \
     assert_non_null((NODE).realtype); \
     assert_int_equal(LY_TYPE_ENUM, (NODE).realtype->basetype); \
     assert_string_equal(VALUE, (NODE).enum_item->name);
@@ -978,7 +978,7 @@
  */
 #define CHECK_LYD_VALUE_INT8(NODE, CANNONICAL_VAL, VALUE) \
     assert_non_null((NODE).realtype->plugin->print(UTEST_LYCTX, &(NODE), LY_VALUE_CANON, NULL, NULL, NULL)); \
-    assert_string_equal((NODE).canonical, CANNONICAL_VAL); \
+    assert_string_equal((NODE)._canonical, CANNONICAL_VAL); \
     assert_non_null((NODE).realtype); \
     assert_int_equal(LY_TYPE_INT8, (NODE).realtype->basetype); \
     assert_int_equal(VALUE, (NODE).int8);
@@ -992,7 +992,7 @@
  */
 #define CHECK_LYD_VALUE_INT16(NODE, CANNONICAL_VAL, VALUE) \
     assert_non_null((NODE).realtype->plugin->print(UTEST_LYCTX, &(NODE), LY_VALUE_CANON, NULL, NULL, NULL)); \
-    assert_string_equal((NODE).canonical, CANNONICAL_VAL); \
+    assert_string_equal((NODE)._canonical, CANNONICAL_VAL); \
     assert_non_null((NODE).realtype); \
     assert_int_equal(LY_TYPE_INT16, (NODE).realtype->basetype); \
     assert_int_equal(VALUE, (NODE).int16);
@@ -1006,7 +1006,7 @@
  */
 #define CHECK_LYD_VALUE_UINT8(NODE, CANNONICAL_VAL, VALUE) \
     assert_non_null((NODE).realtype->plugin->print(UTEST_LYCTX, &(NODE), LY_VALUE_CANON, NULL, NULL, NULL)); \
-    assert_string_equal((NODE).canonical, CANNONICAL_VAL); \
+    assert_string_equal((NODE)._canonical, CANNONICAL_VAL); \
     assert_non_null((NODE).realtype); \
     assert_int_equal(LY_TYPE_UINT8, (NODE).realtype->basetype); \
     assert_int_equal(VALUE, (NODE).uint8);
@@ -1020,7 +1020,7 @@
  */
 #define CHECK_LYD_VALUE_UINT32(NODE, CANNONICAL_VAL, VALUE) \
     assert_non_null((NODE).realtype->plugin->print(UTEST_LYCTX, &(NODE), LY_VALUE_CANON, NULL, NULL, NULL)); \
-    assert_string_equal((NODE).canonical, CANNONICAL_VAL); \
+    assert_string_equal((NODE)._canonical, CANNONICAL_VAL); \
     assert_non_null((NODE).realtype); \
     assert_int_equal(LY_TYPE_UINT32, (NODE).realtype->basetype); \
     assert_int_equal(VALUE, (NODE).uint32);
@@ -1033,7 +1033,7 @@
  */
 #define CHECK_LYD_VALUE_STRING(NODE, CANNONICAL_VAL) \
     assert_non_null((NODE).realtype->plugin->print(UTEST_LYCTX, &(NODE), LY_VALUE_CANON, NULL, NULL, NULL)); \
-    assert_string_equal((NODE).canonical, CANNONICAL_VAL); \
+    assert_string_equal((NODE)._canonical, CANNONICAL_VAL); \
     assert_non_null((NODE).realtype); \
     assert_int_equal(LY_TYPE_STRING, (NODE).realtype->basetype);
 
@@ -1045,7 +1045,7 @@
  */
 #define CHECK_LYD_VALUE_LEAFREF(NODE, CANNONICAL_VAL) \
     assert_non_null((NODE).realtype->plugin->print(UTEST_LYCTX, &(NODE), LY_VALUE_CANON, NULL, NULL, NULL)); \
-    assert_string_equal((NODE).canonical, CANNONICAL_VAL); \
+    assert_string_equal((NODE)._canonical, CANNONICAL_VAL); \
     assert_non_null((NODE).realtype); \
     assert_int_equal(LY_TYPE_LEAFREF, (NODE).realtype->basetype); \
     assert_non_null((NODE).ptr)
@@ -1059,7 +1059,7 @@
 */
 #define CHECK_LYD_VALUE_DEC64(NODE, CANNONICAL_VAL, VALUE) \
     assert_non_null((NODE).realtype->plugin->print(UTEST_LYCTX, &(NODE), LY_VALUE_CANON, NULL, NULL, NULL)); \
-    assert_string_equal((NODE).canonical, CANNONICAL_VAL); \
+    assert_string_equal((NODE)._canonical, CANNONICAL_VAL); \
     assert_non_null((NODE).realtype); \
     assert_int_equal(LY_TYPE_DEC64, (NODE).realtype->basetype); \
     assert_int_equal(VALUE, (NODE).dec64);
@@ -1072,7 +1072,7 @@
 */
 #define CHECK_LYD_VALUE_BINARY(NODE, CANNONICAL_VAL) \
     assert_non_null((NODE).realtype->plugin->print(UTEST_LYCTX, &(NODE), LY_VALUE_CANON, NULL, NULL, NULL)); \
-    assert_string_equal((NODE).canonical, CANNONICAL_VAL); \
+    assert_string_equal((NODE)._canonical, CANNONICAL_VAL); \
     assert_non_null((NODE).realtype); \
     assert_int_equal(LY_TYPE_BINARY, (NODE).realtype->basetype);
 
@@ -1085,7 +1085,7 @@
 */
 #define CHECK_LYD_VALUE_BOOL(NODE, CANNONICAL_VAL, VALUE) \
     assert_non_null((NODE).realtype->plugin->print(UTEST_LYCTX, &(NODE), LY_VALUE_CANON, NULL, NULL, NULL)); \
-    assert_string_equal((NODE).canonical, CANNONICAL_VAL); \
+    assert_string_equal((NODE)._canonical, CANNONICAL_VAL); \
     assert_non_null((NODE).realtype); \
     assert_int_equal(LY_TYPE_BOOL, (NODE).realtype->basetype); \
     assert_int_equal(VALUE, (NODE).boolean);
@@ -1099,7 +1099,7 @@
 */
 #define CHECK_LYD_VALUE_IDENT(NODE, CANNONICAL_VAL, VALUE) \
     assert_non_null((NODE).realtype->plugin->print(UTEST_LYCTX, &(NODE), LY_VALUE_CANON, NULL, NULL, NULL)); \
-    assert_string_equal((NODE).canonical, CANNONICAL_VAL); \
+    assert_string_equal((NODE)._canonical, CANNONICAL_VAL); \
     assert_non_null((NODE).realtype); \
     assert_int_equal(LY_TYPE_IDENT, (NODE).realtype->basetype); \
     assert_string_equal(VALUE, (NODE).ident->name);