- if (structure->fields->pdata[index]) {
- new_field = structure->fields->pdata[index];
- goto end;
- }
-
- /* We don't want to modify this field if it's frozen */
- if (field->frozen) {
- /*
- * Not logging a warning here because the user could
- * legitimately check if a structure field is set with
- * this function: if the preconditions are satisfied,
- * a NULL return value means this.
- */
- BT_LOGV("Not creating a field because structure field is frozen: "
- "struct-field-addr=%p, name=\"%s\"", field, name);
- goto end;
- }
-
- new_field = bt_ctf_field_create(field_type);
- if (!new_field) {
- BT_LOGW("Cannot create field: "
- "struct-field-addr=%p, struct-ft-addr=%p, "
- "field-ft-addr=%p, name=\"%s\"",
- field, field->type, field_type, name);
- goto error;
- }
-
- structure->fields->pdata[index] = new_field;
-end:
- bt_get(new_field);