From: Philippe Proulx Date: Thu, 11 May 2017 21:41:30 +0000 (-0400) Subject: ir: utils: use `bt_bool` instead of `int` where appropriate X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=075edd496508ea91f8ca7f04bced444ce1722c48;p=deliverable%2Fbabeltrace.git ir: utils: use `bt_bool` instead of `int` where appropriate Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- 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); +}