Omit 'value' from is_set and reset field functions
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 16 Sep 2017 02:12:32 +0000 (22:12 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 16 Sep 2017 02:24:30 +0000 (22:24 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
bindings/python/bt2/bt2/fields.py
bindings/python/bt2/bt2/native_btfields.i
include/babeltrace/ctf-ir/fields.h
lib/ctf-ir/fields.c
lib/ctf-ir/stream.c

index d34efdf7c636d145b959303f12b5ada5e35fa66b..e3cbbef5a75ad5845107a2a9be6753a319f1d0bf 100644 (file)
@@ -78,11 +78,11 @@ class _Field(object._Object, metaclass=abc.ABCMeta):
 
     @property
     def is_set(self):
-        is_set = native_bt.ctf_field_value_is_set(self._ptr)
+        is_set = native_bt.ctf_field_is_set(self._ptr)
         return is_set > 0
 
     def reset(self):
-        ret = native_bt.ctf_field_reset_value(self._ptr)
+        ret = native_bt.ctf_field_reset(self._ptr)
         utils._handle_ret(ret, "cannot reset field object's value")
 
 
index c651122dd6b696bb00adc367d155af5729931fd1..cc194406536eb41c895e3b545fe15cb1138ebe97 100644 (file)
@@ -31,8 +31,8 @@ struct bt_ctf_field *bt_ctf_field_create(
 struct bt_ctf_field_type *bt_ctf_field_get_type(
                struct bt_ctf_field *field);
 struct bt_ctf_field *bt_ctf_field_copy(struct bt_ctf_field *field);
-bt_bool bt_ctf_field_value_is_set(struct bt_ctf_field *field);
-int bt_ctf_field_reset_value(struct bt_ctf_field *field);
+bt_bool bt_ctf_field_is_set(struct bt_ctf_field *field);
+int bt_ctf_field_reset(struct bt_ctf_field *field);
 
 /* Integer field functions */
 int bt_ctf_field_signed_integer_get_value(struct bt_ctf_field *integer,
index 6ad01212b094ce153f511b0aa7b85b6c01926f1b..a6250ed7ab7f1b10b3ede5ae0cdd1276a5fe0cc8 100644 (file)
@@ -220,9 +220,9 @@ extern enum bt_ctf_field_type_id bt_ctf_field_get_type_id(
                struct bt_ctf_field *field);
 
 
-extern bt_bool bt_ctf_field_value_is_set(struct bt_ctf_field *field);
+extern bt_bool bt_ctf_field_is_set(struct bt_ctf_field *field);
 
-extern int bt_ctf_field_reset_value(struct bt_ctf_field *field);
+extern int bt_ctf_field_reset(struct bt_ctf_field *field);
 
 /*
  * bt_ctf_field_signed_integer_get_value: get a signed integer field's value
index 10dddaf01fbde2cb2b8efe1eef76c7d0a052a855..32faa920b9ae605a235025c349586687f1fd2e97 100644 (file)
@@ -95,19 +95,19 @@ static
 int bt_ctf_field_sequence_validate(struct bt_ctf_field *);
 
 static
-int bt_ctf_field_generic_reset_value(struct bt_ctf_field *);
+int bt_ctf_field_generic_reset(struct bt_ctf_field *);
 static
-int bt_ctf_field_structure_reset_value(struct bt_ctf_field *);
+int bt_ctf_field_structure_reset(struct bt_ctf_field *);
 static
-int bt_ctf_field_variant_reset_value(struct bt_ctf_field *);
+int bt_ctf_field_variant_reset(struct bt_ctf_field *);
 static
-int bt_ctf_field_enumeration_reset_value(struct bt_ctf_field *);
+int bt_ctf_field_enumeration_reset(struct bt_ctf_field *);
 static
-int bt_ctf_field_array_reset_value(struct bt_ctf_field *);
+int bt_ctf_field_array_reset(struct bt_ctf_field *);
 static
-int bt_ctf_field_sequence_reset_value(struct bt_ctf_field *);
+int bt_ctf_field_sequence_reset(struct bt_ctf_field *);
 static
-int bt_ctf_field_string_reset_value(struct bt_ctf_field *);
+int bt_ctf_field_string_reset(struct bt_ctf_field *);
 
 static
 int bt_ctf_field_integer_serialize(struct bt_ctf_field *,
@@ -166,17 +166,17 @@ static
 void bt_ctf_field_sequence_freeze(struct bt_ctf_field *);
 
 static
-bt_bool bt_ctf_field_generic_value_is_set(struct bt_ctf_field *);
+bt_bool bt_ctf_field_generic_is_set(struct bt_ctf_field *);
 static
-bt_bool bt_ctf_field_structure_value_is_set(struct bt_ctf_field *);
+bt_bool bt_ctf_field_structure_is_set(struct bt_ctf_field *);
 static
-bt_bool bt_ctf_field_variant_value_is_set(struct bt_ctf_field *);
+bt_bool bt_ctf_field_variant_is_set(struct bt_ctf_field *);
 static
-bt_bool bt_ctf_field_enumeration_value_is_set(struct bt_ctf_field *);
+bt_bool bt_ctf_field_enumeration_is_set(struct bt_ctf_field *);
 static
-bt_bool bt_ctf_field_array_value_is_set(struct bt_ctf_field *);
+bt_bool bt_ctf_field_array_is_set(struct bt_ctf_field *);
 static
-bt_bool bt_ctf_field_sequence_value_is_set(struct bt_ctf_field *);
+bt_bool bt_ctf_field_sequence_is_set(struct bt_ctf_field *);
 
 static
 int increase_packet_size(struct bt_ctf_stream_pos *pos);
@@ -221,15 +221,15 @@ int (* const field_validate_funcs[])(struct bt_ctf_field *) = {
 };
 
 static
-int (* const field_reset_value_funcs[])(struct bt_ctf_field *) = {
-       [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_generic_reset_value,
-       [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_reset_value,
-       [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_generic_reset_value,
-       [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_reset_value,
-       [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_reset_value,
-       [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_reset_value,
-       [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_reset_value,
-       [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_string_reset_value,
+int (* const field_reset_funcs[])(struct bt_ctf_field *) = {
+       [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_generic_reset,
+       [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_reset,
+       [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_generic_reset,
+       [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_reset,
+       [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_reset,
+       [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_reset,
+       [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_reset,
+       [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_string_reset,
 };
 
 static
@@ -272,15 +272,15 @@ void (* const field_freeze_funcs[])(struct bt_ctf_field *) = {
 };
 
 static
-bt_bool (* const field_value_is_set_funcs[])(struct bt_ctf_field *) = {
-       [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_generic_value_is_set,
-       [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_value_is_set,
-       [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_generic_value_is_set,
-       [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_value_is_set,
-       [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_value_is_set,
-       [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_value_is_set,
-       [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_value_is_set,
-       [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_generic_value_is_set,
+bt_bool (* const field_is_set_funcs[])(struct bt_ctf_field *) = {
+       [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_generic_is_set,
+       [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_is_set,
+       [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_generic_is_set,
+       [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_is_set,
+       [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_is_set,
+       [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_is_set,
+       [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_is_set,
+       [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_generic_is_set,
 };
 
 struct bt_ctf_field *bt_ctf_field_create(struct bt_ctf_field_type *type)
@@ -483,7 +483,7 @@ int bt_ctf_field_sequence_set_length(struct bt_ctf_field *field,
                goto end;
        }
 
-       if (!bt_ctf_field_value_is_set(length_field)) {
+       if (!bt_ctf_field_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,
@@ -1608,7 +1608,7 @@ end:
        return ret;
 }
 
-int bt_ctf_field_reset_value(struct bt_ctf_field *field)
+int bt_ctf_field_reset(struct bt_ctf_field *field)
 {
        int ret = 0;
        enum bt_ctf_field_type_id type_id;
@@ -1635,7 +1635,7 @@ int bt_ctf_field_reset_value(struct bt_ctf_field *field)
                goto end;
        }
 
-       ret = field_reset_value_funcs[type_id](field);
+       ret = field_reset_funcs[type_id](field);
 end:
        return ret;
 }
@@ -1670,9 +1670,9 @@ end:
        return ret;
 }
 
-bt_bool bt_ctf_field_value_is_set(struct bt_ctf_field *field)
+bt_bool bt_ctf_field_is_set(struct bt_ctf_field *field)
 {
-       bt_bool value_is_set = BT_FALSE;
+       bt_bool is_set = BT_FALSE;
        enum bt_ctf_field_type_id type_id;
 
        if (!field) {
@@ -1687,9 +1687,9 @@ bt_bool bt_ctf_field_value_is_set(struct bt_ctf_field *field)
                goto end;
        }
 
-       value_is_set = field_value_is_set_funcs[type_id](field);
+       is_set = field_is_set_funcs[type_id](field);
 end:
-       return value_is_set;
+       return is_set;
 }
 
 struct bt_ctf_field *bt_ctf_field_copy(struct bt_ctf_field *field)
@@ -2218,7 +2218,7 @@ end:
 }
 
 static
-int bt_ctf_field_generic_reset_value(struct bt_ctf_field *field)
+int bt_ctf_field_generic_reset(struct bt_ctf_field *field)
 {
        int ret = 0;
 
@@ -2234,7 +2234,7 @@ end:
 }
 
 static
-int bt_ctf_field_enumeration_reset_value(struct bt_ctf_field *field)
+int bt_ctf_field_enumeration_reset(struct bt_ctf_field *field)
 {
        int ret = 0;
        struct bt_ctf_field_enumeration *enumeration;
@@ -2251,13 +2251,13 @@ int bt_ctf_field_enumeration_reset_value(struct bt_ctf_field *field)
                goto end;
        }
 
-       ret = bt_ctf_field_reset_value(enumeration->payload);
+       ret = bt_ctf_field_reset(enumeration->payload);
 end:
        return ret;
 }
 
 static
-int bt_ctf_field_structure_reset_value(struct bt_ctf_field *field)
+int bt_ctf_field_structure_reset(struct bt_ctf_field *field)
 {
        int64_t i;
        int ret = 0;
@@ -2281,7 +2281,7 @@ int bt_ctf_field_structure_reset_value(struct bt_ctf_field *field)
                        continue;
                }
 
-               ret = bt_ctf_field_reset_value(member);
+               ret = bt_ctf_field_reset(member);
                if (ret) {
                        BT_LOGE("Failed to reset structure field's field: "
                                "struct-field-addr=%p, field-addr=%p, "
@@ -2294,7 +2294,7 @@ end:
 }
 
 static
-int bt_ctf_field_variant_reset_value(struct bt_ctf_field *field)
+int bt_ctf_field_variant_reset(struct bt_ctf_field *field)
 {
        int ret = 0;
        struct bt_ctf_field_variant *variant;
@@ -2313,7 +2313,7 @@ end:
 }
 
 static
-int bt_ctf_field_array_reset_value(struct bt_ctf_field *field)
+int bt_ctf_field_array_reset(struct bt_ctf_field *field)
 {
        size_t i;
        int ret = 0;
@@ -2337,7 +2337,7 @@ int bt_ctf_field_array_reset_value(struct bt_ctf_field *field)
                        continue;
                }
 
-               ret = bt_ctf_field_reset_value(member);
+               ret = bt_ctf_field_reset(member);
                if (ret) {
                        BT_LOGE("Failed to reset array field's field: "
                                "array-field-addr=%p, field-addr=%p, "
@@ -2350,7 +2350,7 @@ end:
 }
 
 static
-int bt_ctf_field_sequence_reset_value(struct bt_ctf_field *field)
+int bt_ctf_field_sequence_reset(struct bt_ctf_field *field)
 {
        int ret = 0;
        struct bt_ctf_field_sequence *sequence;
@@ -2372,7 +2372,7 @@ end:
 }
 
 static
-int bt_ctf_field_string_reset_value(struct bt_ctf_field *field)
+int bt_ctf_field_string_reset(struct bt_ctf_field *field)
 {
        int ret = 0;
        struct bt_ctf_field_string *string;
@@ -2383,7 +2383,7 @@ int bt_ctf_field_string_reset_value(struct bt_ctf_field *field)
                goto end;
        }
 
-       ret = bt_ctf_field_generic_reset_value(field);
+       ret = bt_ctf_field_generic_reset(field);
        if (ret) {
                goto end;
        }
@@ -2409,7 +2409,7 @@ int bt_ctf_field_integer_serialize(struct bt_ctf_field *field,
                "native-bo=%s", field, pos->offset,
                bt_ctf_byte_order_string(native_byte_order));
 
-       if (!bt_ctf_field_generic_value_is_set(field)) {
+       if (!bt_ctf_field_generic_is_set(field)) {
                BT_LOGW_STR("Field's payload is not set.");
                ret = -1;
                goto end;
@@ -2461,7 +2461,7 @@ int bt_ctf_field_floating_point_serialize(struct bt_ctf_field *field,
                "native-bo=%s", field, pos->offset,
                bt_ctf_byte_order_string(native_byte_order));
 
-       if (!bt_ctf_field_generic_value_is_set(field)) {
+       if (!bt_ctf_field_generic_is_set(field)) {
                BT_LOGW_STR("Field's payload is not set.");
                ret = -1;
                goto end;
@@ -3130,15 +3130,15 @@ end:
 }
 
 static
-bt_bool bt_ctf_field_generic_value_is_set(struct bt_ctf_field *field)
+bt_bool bt_ctf_field_generic_is_set(struct bt_ctf_field *field)
 {
        return field && field->payload_set;
 }
 
 static
-bt_bool bt_ctf_field_enumeration_value_is_set(struct bt_ctf_field *field)
+bt_bool bt_ctf_field_enumeration_is_set(struct bt_ctf_field *field)
 {
-       bt_bool value_is_set = BT_FALSE;
+       bt_bool is_set = BT_FALSE;
        struct bt_ctf_field_enumeration *enumeration;
 
        if (!field) {
@@ -3151,15 +3151,15 @@ bt_bool bt_ctf_field_enumeration_value_is_set(struct bt_ctf_field *field)
                goto end;
        }
 
-       value_is_set = bt_ctf_field_value_is_set(enumeration->payload);
+       is_set = bt_ctf_field_is_set(enumeration->payload);
 end:
-       return value_is_set;
+       return is_set;
 }
 
 static
-bt_bool bt_ctf_field_structure_value_is_set(struct bt_ctf_field *field)
+bt_bool bt_ctf_field_structure_is_set(struct bt_ctf_field *field)
 {
-       bt_bool value_is_set = BT_FALSE;
+       bt_bool is_set = BT_FALSE;
        size_t i;
        struct bt_ctf_field_structure *structure;
 
@@ -3169,20 +3169,20 @@ 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(
+               is_set = bt_ctf_field_is_set(
                        structure->fields->pdata[i]);
-               if (!value_is_set) {
+               if (!is_set) {
                        goto end;
                }
        }
 end:
-       return value_is_set;
+       return is_set;
 }
 
 static
-bt_bool bt_ctf_field_variant_value_is_set(struct bt_ctf_field *field)
+bt_bool bt_ctf_field_variant_is_set(struct bt_ctf_field *field)
 {
-       bt_bool value_is_set = BT_FALSE;
+       bt_bool is_set = BT_FALSE;
        struct bt_ctf_field_variant *variant;
 
        if (!field) {
@@ -3190,16 +3190,16 @@ bt_bool bt_ctf_field_variant_value_is_set(struct bt_ctf_field *field)
        }
 
        variant = container_of(field, struct bt_ctf_field_variant, parent);
-       value_is_set = bt_ctf_field_value_is_set(variant->payload);
+       is_set = bt_ctf_field_is_set(variant->payload);
 end:
-       return value_is_set;
+       return is_set;
 }
 
 static
-bt_bool bt_ctf_field_array_value_is_set(struct bt_ctf_field *field)
+bt_bool bt_ctf_field_array_is_set(struct bt_ctf_field *field)
 {
        size_t i;
-       bt_bool value_is_set = BT_FALSE;
+       bt_bool is_set = BT_FALSE;
        struct bt_ctf_field_array *array;
 
        if (!field) {
@@ -3208,20 +3208,20 @@ bt_bool bt_ctf_field_array_value_is_set(struct bt_ctf_field *field)
 
        array = container_of(field, struct bt_ctf_field_array, parent);
        for (i = 0; i < array->elements->len; i++) {
-               value_is_set = bt_ctf_field_value_is_set(array->elements->pdata[i]);
-               if (!value_is_set) {
+               is_set = bt_ctf_field_is_set(array->elements->pdata[i]);
+               if (!is_set) {
                        goto end;
                }
        }
 end:
-       return value_is_set;
+       return is_set;
 }
 
 static
-bt_bool bt_ctf_field_sequence_value_is_set(struct bt_ctf_field *field)
+bt_bool bt_ctf_field_sequence_is_set(struct bt_ctf_field *field)
 {
        size_t i;
-       bt_bool value_is_set = BT_FALSE;
+       bt_bool is_set = BT_FALSE;
        struct bt_ctf_field_sequence *sequence;
 
        if (!field) {
@@ -3234,11 +3234,11 @@ bt_bool bt_ctf_field_sequence_value_is_set(struct bt_ctf_field *field)
        }
 
        for (i = 0; i < sequence->elements->len; i++) {
-               value_is_set = bt_ctf_field_value_is_set(sequence->elements->pdata[i]);
-               if (!value_is_set) {
+               is_set = bt_ctf_field_is_set(sequence->elements->pdata[i]);
+               if (!is_set) {
                        goto end;
                }
        }
 end:
-       return value_is_set;
+       return is_set;
 }
index 5741a7a520f6fbc4126f50ec031b5be12f269174..70f08d189e3d8ce01b98e581ea4b1b4999c24719 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_value_is_set(field)) {
+       if (bt_ctf_field_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_value(member);
+               (void) bt_ctf_field_reset(member);
                bt_put(member);
        }
 }
@@ -1862,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_value_is_set(integer)) {
+       if (!force && bt_ctf_field_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.034705 seconds and 4 git commands to generate.