Add utility function to validate CTF identifiers
[babeltrace.git] / formats / ctf / ir / stream-class.c
index 6f1ec13e0501213222b1d55efb68527e3a5ccc11..d034340da2df756e6e20e4704f59250fe815eb3c 100644 (file)
@@ -35,6 +35,7 @@
 #include <babeltrace/ctf-writer/stream.h>
 #include <babeltrace/ctf-ir/stream-class-internal.h>
 #include <babeltrace/ctf-writer/functor-internal.h>
+#include <babeltrace/ctf-ir/utils.h>
 #include <babeltrace/compiler.h>
 #include <babeltrace/align.h>
 
@@ -52,7 +53,7 @@ struct bt_ctf_stream_class *bt_ctf_stream_class_create(const char *name)
        int ret;
        struct bt_ctf_stream_class *stream_class = NULL;
 
-       if (!name || !strlen(name)) {
+       if (!name || !strlen(name) || bt_ctf_validate_identifier(name)) {
                goto error;
        }
 
@@ -151,7 +152,7 @@ int bt_ctf_stream_class_set_id(struct bt_ctf_stream_class *stream_class,
 {
        int ret = 0;
 
-       if (!stream_class) {
+       if (!stream_class || stream_class->frozen) {
                ret = -1;
                goto end;
        }
This page took 0.024608 seconds and 4 git commands to generate.