Fix build with BUILT_IN_PLUGINS=1
[babeltrace.git] / lib / ctf-ir / utils.c
index 318b12da4a26105dda011759762e1ece8ea53275..0ab0df2464c72df45ecb898f886c5c8522824b89 100644 (file)
  * SOFTWARE.
  */
 
+#define BT_LOG_TAG "CTF-IR-UTILS"
+#include <babeltrace/lib-logging-internal.h>
+
 #include <string.h>
 #include <stdlib.h>
 #include <glib.h>
+#include <babeltrace/ctf-ir/utils.h>
 
 static
 const char * const reserved_keywords_str[] = {"align", "callsite",
@@ -78,13 +82,20 @@ int bt_ctf_validate_identifier(const char *input_string)
        char *string = NULL;
        char *save_ptr, *token;
 
-       if (!input_string || input_string[0] == '\0') {
+       if (!input_string) {
+               BT_LOGV_STR("Invalid parameter: input string is NULL.");
+               ret = -1;
+               goto end;
+       }
+
+       if (input_string[0] == '\0') {
                ret = -1;
                goto end;
        }
 
        string = strdup(input_string);
        if (!string) {
+               BT_LOGE("strdup() failed.");
                ret = -1;
                goto end;
        }
@@ -104,3 +115,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.027852 seconds and 4 git commands to generate.