Skip to content

Commit

Permalink
version UPDATE retrieve versions using functions
Browse files Browse the repository at this point in the history
To avoid cuplicit structure definition in plugin
test.
  • Loading branch information
michalvasko committed Jul 15, 2024
1 parent f1918e1 commit 1158163
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 22 deletions.
58 changes: 46 additions & 12 deletions src/ly_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
59 changes: 49 additions & 10 deletions src/version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,61 @@ extern "C" {
#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 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 extern struct ly_version ly_version_proj;
LIBYANG_API_DECL const char *ly_version_proj_str(void);

#ifdef __cplusplus
}
Expand Down

0 comments on commit 1158163

Please sign in to comment.