Cleanup: line exceeds 80 chars
[babeltrace.git] / lib / ctf-ir / fields.c
index 05be90fe63dd610a9474ad26676d589964a8b43a..10dddaf01fbde2cb2b8efe1eef76c7d0a052a855 100644 (file)
@@ -483,6 +483,15 @@ int bt_ctf_field_sequence_set_length(struct bt_ctf_field *field,
                goto end;
        }
 
+       if (!bt_ctf_field_value_is_set(length_field)) {
+               BT_LOGW("Invalid parameter: length field's value is not set: "
+                       "field-addr=%p, length-field-addr=%p, "
+                       "length-field-ft-addr=%p", field, length_field,
+                       length_field->type);
+               ret = -1;
+               goto end;
+       }
+
        length = container_of(length_field, struct bt_ctf_field_integer,
                parent);
        sequence_length = length->payload.unsignd;
@@ -504,6 +513,7 @@ int bt_ctf_field_sequence_set_length(struct bt_ctf_field *field,
        g_ptr_array_set_size(sequence->elements, (size_t) sequence_length);
        bt_get(length_field);
        sequence->length = length_field;
+       bt_ctf_field_freeze(length_field);
 end:
        return ret;
 }
@@ -3159,7 +3169,8 @@ bt_bool bt_ctf_field_structure_value_is_set(struct bt_ctf_field *field)
 
        structure = container_of(field, struct bt_ctf_field_structure, parent);
        for (i = 0; i < structure->fields->len; i++) {
-               value_is_set = bt_ctf_field_value_is_set(structure->fields->pdata[i]);
+               value_is_set = bt_ctf_field_value_is_set(
+                       structure->fields->pdata[i]);
                if (!value_is_set) {
                        goto end;
                }
This page took 0.024997 seconds and 4 git commands to generate.