Skip to content

Commit

Permalink
lib: add bt_version_get_name() and bt_version_get_name_description()
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: If080c93994ac5869e29061b21d7b5c35387985d3
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2834
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
  • Loading branch information
eepp authored and jgalar committed Jan 21, 2020
1 parent 3149cde commit 2491e1b
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
33 changes: 33 additions & 0 deletions include/babeltrace2/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ library's version:
<dt>Extra information</dt>
<dd>bt_version_get_extra()</dd>
</dl>
You can also get the version's name and description if available with
bt_version_get_name() and bt_version_get_name_description().
*/

/*! @{ */
Expand Down Expand Up @@ -96,6 +99,36 @@ This extra information can contain a version suffix such as
*/
extern const char *bt_version_get_extra(void);

/*!
@brief
Returns libbabeltrace2's version name.
If the version name is not available, which can be the case for a
development build, this function returns \c NULL.
@returns
Library's version name, or \c NULL if not available.
@sa bt_version_get_name_description() &mdash;
Returns the description of libbabeltrace2's version name.
*/
extern const char *bt_version_get_name(void);

/*!
@brief
Returns libbabeltrace2's version name's description.
If the version name's description is not available, which can be the
case for a development build, this function returns \c NULL.
@returns
Library's version name's description, or \c NULL if not available.
@sa bt_version_get_name() &mdash;
Returns libbabeltrace2's version name.
*/
extern const char *bt_version_get_name_description(void);

/*! @} */

#ifdef __cplusplus
Expand Down
11 changes: 11 additions & 0 deletions src/lib/babeltrace2.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,14 @@ const char *bt_version_get_extra(void)
{
return strlen(BT_VERSION_EXTRA) == 0 ? NULL : BT_VERSION_EXTRA;
}

const char *bt_version_get_name(void)
{
return strlen(BT_VERSION_NAME) == 0 ? NULL : BT_VERSION_NAME;
}

const char *bt_version_get_name_description(void)
{
return strlen(BT_VERSION_DESCRIPTION) == 0 ? NULL :
BT_VERSION_DESCRIPTION;
}

0 comments on commit 2491e1b

Please sign in to comment.