ir: utils: use `bt_bool` instead of `int` where appropriate
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 11 May 2017 21:41:30 +0000 (17:41 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 28 May 2017 16:57:42 +0000 (12:57 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/babeltrace/ctf-ir/utils.h
lib/ctf-ir/utils.c

index 21db2e72a1b65c36b9061ff8ee3dfedda1ad1425..d94b215d605fd689735b4c476896e22918c225fc 100644 (file)
@@ -30,6 +30,8 @@
  * http://www.efficios.com/ctf
  */
 
+#include <babeltrace/types.h>
+
 #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
index 318b12da4a26105dda011759762e1ece8ea53275..c83b50d9916376968ad546b8d8eabfbb28b50011 100644 (file)
@@ -29,6 +29,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <glib.h>
+#include <babeltrace/ctf-ir/utils.h>
 
 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);
+}
This page took 0.026227 seconds and 4 git commands to generate.