Add field value is_set and reset functions to the public API
[babeltrace.git] / lib / ctf-ir / stream.c
index 4ce2fe3016dce3957c4d078cf7c3e194f268bc87..5741a7a520f6fbc4126f50ec031b5be12f269174 100644 (file)
@@ -360,7 +360,7 @@ int set_packet_context_events_discarded(struct bt_ctf_stream *stream)
         * discarded events. We do not allow wrapping here. If it's
         * valid, update the stream's current count.
         */
-       if (bt_ctf_field_is_set(field)) {
+       if (bt_ctf_field_value_is_set(field)) {
                uint64_t user_val;
 
                ret = bt_ctf_field_unsigned_integer_get_value(field,
@@ -1494,7 +1494,7 @@ void reset_structure_field(struct bt_ctf_field *structure, const char *name)
 
        member = bt_ctf_field_structure_get_field(structure, name);
        if (member) {
-               (void) bt_ctf_field_reset(member);
+               (void) bt_ctf_field_reset_value(member);
                bt_put(member);
        }
 }
@@ -1715,17 +1715,6 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream)
        stream->flushed_packet_count++;
        stream->size += stream->pos.packet_size / CHAR_BIT;
 
-       do {
-               ret = ftruncate(stream->pos.fd, stream->size);
-       } while (ret == -1 && errno == EINTR);
-       if (ret == -1) {
-               BT_LOGE_ERRNO("Cannot truncate stream file to new size",
-                               ": size=%" PRIu64 ", stream-addr=%p, "
-                               "stream-name=\"%s\"",
-                               stream->size, stream,
-                               bt_ctf_stream_get_name(stream));
-       }
-
 end:
        /* Reset automatically-set fields. */
        if (stream->packet_context) {
@@ -1873,7 +1862,7 @@ int _set_structure_field_integer(struct bt_ctf_field *structure, char *name,
        }
 
        /* Make sure the payload has not already been set. */
-       if (!force && bt_ctf_field_is_set(integer)) {
+       if (!force && bt_ctf_field_value_is_set(integer)) {
                /* Payload already set, not an error */
                BT_LOGV("Field's payload is already set: struct-field-addr=%p, "
                        "name=\"%s\", force=%d", structure, name, force);
This page took 0.023127 seconds and 4 git commands to generate.