From 075edd496508ea91f8ca7f04bced444ce1722c48 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Thu, 11 May 2017 17:41:30 -0400 Subject: [PATCH] ir: utils: use `bt_bool` instead of `int` where appropriate MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- include/babeltrace/ctf-ir/utils.h | 11 ++++++++--- lib/ctf-ir/utils.c | 6 ++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/babeltrace/ctf-ir/utils.h b/include/babeltrace/ctf-ir/utils.h index 21db2e72a..d94b215d6 100644 --- a/include/babeltrace/ctf-ir/utils.h +++ b/include/babeltrace/ctf-ir/utils.h @@ -30,6 +30,8 @@ * http://www.efficios.com/ctf */ +#include + #ifdef __cplusplus extern "C" { #endif @@ -59,15 +61,18 @@ This function returns a negative value if \p identifier is a CTF keyword or if it does not meet any other imposed requirement. @param[in] identifier String to test. -@returns 0 if \p identifier is a valid identifier, or - a negative value otherwise or on error. +@returns #BT_TRUE if \p identifier is a valid CTF + identifier, or #BT_FALSE otherwise. @prenotnull{identifier} */ -extern int bt_ctf_validate_identifier(const char *identifier); +extern bt_bool bt_ctf_identifier_is_valid(const char *identifier); /** @} */ +/* Pre-2.0 CTF writer compatibility */ +extern int bt_ctf_validate_identifier(const char *identifier); + #ifdef __cplusplus } #endif diff --git a/lib/ctf-ir/utils.c b/lib/ctf-ir/utils.c index 318b12da4..c83b50d99 100644 --- a/lib/ctf-ir/utils.c +++ b/lib/ctf-ir/utils.c @@ -29,6 +29,7 @@ #include #include #include +#include static const char * const reserved_keywords_str[] = {"align", "callsite", @@ -104,3 +105,8 @@ end: free(string); return ret; } + +bt_bool bt_ctf_identifier_is_valid(const char *identifier) +{ + return bt_ctf_validate_identifier(identifier); +} -- 2.34.1