schema CHANGE move ly_stmt2str() into public API
Useful function to work with the statements enumeration. However to
hide the internal structure holding the information about the
statements, change it from macro to a function.
diff --git a/src/tree_schema.c b/src/tree_schema.c
index 4377cfd..e58e26b 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -129,6 +129,12 @@
[LY_STMT_YIN_ELEMENT] = {"yin-element", "value", STMT_FLAG_ID},
};
+API const char *
+ly_stmt2str(enum ly_stmt stmt)
+{
+ return stmt_attr_info[stmt].name;
+}
+
const char * const ly_devmod_list[] = {
[LYS_DEV_NOT_SUPPORTED] = "not-supported",
[LYS_DEV_ADD] = "add",
diff --git a/src/tree_schema.h b/src/tree_schema.h
index 142a33d..02e932c 100644
--- a/src/tree_schema.h
+++ b/src/tree_schema.h
@@ -442,6 +442,13 @@
const char *lyext_parent2str(LYEXT_PARENT type);
/**
+ * @brief Stringify statement identifier.
+ * @param[in] stmt The statement identifier to stringify.
+ * @return Constant string representation of the given @p stmt.
+ */
+const char *ly_stmt2str(enum ly_stmt stmt);
+
+/**
* @brief Convert nodetype to statement identifier
* @param[in] nodetype Nodetype to convert.
* @return Statement identifier representing the given @p nodetype.
diff --git a/src/tree_schema_internal.h b/src/tree_schema_internal.h
index 6c13882..cdc478f 100644
--- a/src/tree_schema_internal.h
+++ b/src/tree_schema_internal.h
@@ -48,9 +48,6 @@
/* statements informations filled in tree_schema.c */
extern struct stmt_info_s stmt_attr_info[];
-/* list of the YANG statements strings */
-#define ly_stmt2str(STMT) stmt_attr_info[STMT].name
-
/* list of the deviate modifications strings */
extern const char * const ly_devmod_list[];
#define ly_devmod2str(TYPE) ly_devmod_list[TYPE]