tree data BUGFIX move defn of named union/struct out of struct
Defining a named union or struct inside another struct does not expose
that union globally in C++. Thus one can't, for example, use "union
lyd_any_value *foo" in C++.
Signed-off-by: Christian Hopps <chopps@labn.net>
diff --git a/src/tree_data.h b/src/tree_data.h
index 497db49..26e1f05 100644
--- a/src/tree_data.h
+++ b/src/tree_data.h
@@ -718,7 +718,19 @@
};
/**
- * @brief Data node structure for the anydata data tree nodes - anydata or anyxml.
+ * @brief union for anydata/anyxml value representation.
+ */
+union lyd_any_value {
+ struct lyd_node *tree; /**< data tree */
+ const char *str; /**< Generic string data */
+ const char *xml; /**< Serialized XML data */
+ const char *json; /**< I-JSON encoded string */
+ char *mem; /**< LYD_ANYDATA_LYB memory chunk */
+};
+
+/**
+ * @brief Data node structure for the anydata data tree nodes - anydata or
+ * anyxml.
*/
struct lyd_node_any {
union {
@@ -742,13 +754,7 @@
};
}; /**< common part corresponding to ::lyd_node */
- union lyd_any_value {
- struct lyd_node *tree; /**< data tree */
- const char *str; /**< Generic string data */
- const char *xml; /**< Serialized XML data */
- const char *json; /**< I-JSON encoded string */
- char *mem; /**< LYD_ANYDATA_LYB memory chunk */
- } value; /**< pointer to the stored value representation of the anydata/anyxml node */
+ union lyd_any_value value; /**< pointer to the stored value representation of the anydata/anyxml node */
LYD_ANYDATA_VALUETYPE value_type; /**< type of the data stored as ::lyd_node_any.value */
};