void bt_ctf_field_string_destroy(struct bt_ctf_field *);
static
-int bt_ctf_field_generic_validate(struct bt_ctf_field *field);
+int bt_ctf_field_generic_validate(struct bt_ctf_field *);
static
-int bt_ctf_field_structure_validate(struct bt_ctf_field *field);
+int bt_ctf_field_structure_validate(struct bt_ctf_field *);
static
-int bt_ctf_field_variant_validate(struct bt_ctf_field *field);
+int bt_ctf_field_variant_validate(struct bt_ctf_field *);
static
-int bt_ctf_field_enumeration_validate(struct bt_ctf_field *field);
+int bt_ctf_field_enumeration_validate(struct bt_ctf_field *);
static
-int bt_ctf_field_array_validate(struct bt_ctf_field *field);
+int bt_ctf_field_array_validate(struct bt_ctf_field *);
static
-int bt_ctf_field_sequence_validate(struct bt_ctf_field *field);
+int bt_ctf_field_sequence_validate(struct bt_ctf_field *);
static
-int bt_ctf_field_generic_reset(struct bt_ctf_field *field);
+int bt_ctf_field_generic_reset(struct bt_ctf_field *);
static
-int bt_ctf_field_structure_reset(struct bt_ctf_field *field);
+int bt_ctf_field_structure_reset(struct bt_ctf_field *);
static
-int bt_ctf_field_variant_reset(struct bt_ctf_field *field);
+int bt_ctf_field_variant_reset(struct bt_ctf_field *);
static
-int bt_ctf_field_enumeration_reset(struct bt_ctf_field *field);
+int bt_ctf_field_enumeration_reset(struct bt_ctf_field *);
static
-int bt_ctf_field_array_reset(struct bt_ctf_field *field);
+int bt_ctf_field_array_reset(struct bt_ctf_field *);
static
-int bt_ctf_field_sequence_reset(struct bt_ctf_field *field);
+int bt_ctf_field_sequence_reset(struct bt_ctf_field *);
static
-int bt_ctf_field_string_reset(struct bt_ctf_field *field);
+int bt_ctf_field_string_reset(struct bt_ctf_field *);
static
int bt_ctf_field_integer_serialize(struct bt_ctf_field *,
goto end;
}
- bt_ctf_field_type_get(field->type);
- copy->type = field->type;
ret = field_copy_funcs[type_id](field, copy);
if (ret) {
bt_ctf_field_put(copy);
struct bt_ctf_field_integer *integer_src, *integer_dst;
integer_src = container_of(src, struct bt_ctf_field_integer, parent);
- integer_dst = container_of(src, struct bt_ctf_field_integer, parent);
+ integer_dst = container_of(dst, struct bt_ctf_field_integer, parent);
memcpy(&integer_dst->definition, &integer_src->definition,
sizeof(struct definition_integer));
int bt_ctf_field_structure_copy(struct bt_ctf_field *src,
struct bt_ctf_field *dst)
{
- int ret, i;
+ int ret = 0, i;
struct bt_ctf_field_structure *struct_src, *struct_dst;
struct_src = container_of(src, struct bt_ctf_field_structure, parent);
struct_dst = container_of(dst, struct bt_ctf_field_structure, parent);
+ /* This field_name_to_index HT is owned by the structure field type */
struct_dst->field_name_to_index = struct_src->field_name_to_index;
- struct_dst->fields = g_ptr_array_sized_new(struct_src->fields->len);
- if (!struct_dst->fields) {
- ret = -1;
- goto end;
- }
+ g_ptr_array_set_size(struct_dst->fields, struct_src->fields->len);
for (i = 0; i < struct_src->fields->len; i++) {
struct bt_ctf_field *field_copy = bt_ctf_field_copy(
ret = -1;
goto end;
}
- g_ptr_array_add(struct_dst->fields, field_copy);
+ g_ptr_array_index(struct_dst->fields, i) = field_copy;
}
end:
return ret;
array_src = container_of(src, struct bt_ctf_field_array, parent);
array_dst = container_of(dst, struct bt_ctf_field_array, parent);
- array_dst->elements = g_ptr_array_sized_new(array_src->elements->len);
+ g_ptr_array_set_size(array_dst->elements, array_src->elements->len);
for (i = 0; i < array_src->elements->len; i++) {
struct bt_ctf_field *field_copy = bt_ctf_field_copy(
g_ptr_array_index(array_src->elements, i));
ret = -1;
goto end;
}
- g_ptr_array_add(array_dst->elements, field_copy);
+ g_ptr_array_index(array_dst->elements, i) = field_copy;
}
end:
return ret;
sequence_src = container_of(src, struct bt_ctf_field_sequence, parent);
sequence_dst = container_of(dst, struct bt_ctf_field_sequence, parent);
- sequence_dst->elements = g_ptr_array_sized_new(
+ g_ptr_array_set_size(sequence_dst->elements,
sequence_src->elements->len);
for (i = 0; i < sequence_src->elements->len; i++) {
struct bt_ctf_field *field_copy = bt_ctf_field_copy(
ret = -1;
goto end;
}
- g_ptr_array_add(sequence_dst->elements, field_copy);
+ g_ptr_array_index(sequence_dst->elements, i) = field_copy;
}
end:
return ret;