version UPDATE retrieve versions using functions
To avoid cuplicit structure definition in plugin
test.
diff --git a/src/ly_common.c b/src/ly_common.c
index 28d7514..449c862 100644
--- a/src/ly_common.c
+++ b/src/ly_common.c
@@ -40,19 +40,53 @@
#include "version.h"
#include "xml.h"
-LIBYANG_API_DEF struct ly_version ly_version_so = {
- .major = LY_VERSION_MAJOR,
- .minor = LY_VERSION_MINOR,
- .micro = LY_VERSION_MICRO,
- .str = LY_VERSION
-};
+LIBYANG_API_DEF uint32_t
+ly_version_so_major(void)
+{
+ return LY_VERSION_MAJOR;
+}
-LIBYANG_API_DEF struct ly_version ly_version_proj = {
- .major = LY_PROJ_VERSION_MAJOR,
- .minor = LY_PROJ_VERSION_MINOR,
- .micro = LY_PROJ_VERSION_MICRO,
- .str = LY_PROJ_VERSION
-};
+LIBYANG_API_DEF uint32_t
+ly_version_so_minor(void)
+{
+ return LY_VERSION_MINOR;
+}
+
+LIBYANG_API_DEF uint32_t
+ly_version_so_micro(void)
+{
+ return LY_VERSION_MICRO;
+}
+
+LIBYANG_API_DEF const char *
+ly_version_so_str(void)
+{
+ return LY_VERSION;
+}
+
+LIBYANG_API_DEF uint32_t
+ly_version_proj_major(void)
+{
+ return LY_PROJ_VERSION_MAJOR;
+}
+
+LIBYANG_API_DEF uint32_t
+ly_version_proj_minor(void)
+{
+ return LY_PROJ_VERSION_MINOR;
+}
+
+LIBYANG_API_DEF uint32_t
+ly_version_proj_micro(void)
+{
+ return LY_PROJ_VERSION_MICRO;
+}
+
+LIBYANG_API_DEF const char *
+ly_version_proj_str(void)
+{
+ return LY_PROJ_VERSION;
+}
void *
ly_realloc(void *ptr, size_t size)
diff --git a/src/version.h.in b/src/version.h.in
index 2fe6663..021cd05 100644
--- a/src/version.h.in
+++ b/src/version.h.in
@@ -32,22 +32,61 @@
#define LY_PROJ_VERSION_MICRO @LIBYANG_MICRO_VERSION@ /**< project micro version number */
#define LY_PROJ_VERSION "@LIBYANG_VERSION@" /**< project version string */
-struct ly_version {
- uint32_t major; /**< Major version number */
- uint32_t minor; /**< Minor version number */
- uint32_t micro; /**< Micro version number */
- const char *str; /**< Version string */
-};
+/**
+ * @brief Get libyang major SO version.
+ *
+ * @return LY version.
+ */
+LIBYANG_API_DECL uint32_t ly_version_so_major(void);
/**
- * @brief libyang SO version.
+ * @brief Get libyang minor SO version.
+ *
+ * @return LY version.
*/
-LIBYANG_API_DECL extern struct ly_version ly_version_so;
+LIBYANG_API_DECL uint32_t ly_version_so_minor(void);
/**
- * @brief libyang project version.
+ * @brief Get libyang micro SO version.
+ *
+ * @return LY version.
*/
-LIBYANG_API_DECL extern struct ly_version ly_version_proj;
+LIBYANG_API_DECL uint32_t ly_version_so_micro(void);
+
+/**
+ * @brief Get libyang string SO version.
+ *
+ * @return LY version.
+ */
+LIBYANG_API_DECL const char *ly_version_so_str(void);
+
+/**
+ * @brief Get libyang major project version.
+ *
+ * @return LY version.
+ */
+LIBYANG_API_DECL uint32_t ly_version_proj_major(void);
+
+/**
+ * @brief Get libyang minor project version.
+ *
+ * @return LY version.
+ */
+LIBYANG_API_DECL uint32_t ly_version_proj_minor(void);
+
+/**
+ * @brief Get libyang micro project version.
+ *
+ * @return LY version.
+ */
+LIBYANG_API_DECL uint32_t ly_version_proj_micro(void);
+
+/**
+ * @brief Get libyang string project version.
+ *
+ * @return LY version.
+ */
+LIBYANG_API_DECL const char *ly_version_proj_str(void);
#ifdef __cplusplus
}