ir: add bt_ctf_field_get_type_id()
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 27 Jul 2015 12:49:09 +0000 (08:49 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 30 Jul 2015 13:46:58 +0000 (09:46 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
formats/ctf/ir/event-fields.c
include/babeltrace/ctf-ir/event-fields.h

index a3de98f617063a121e9f9b75da79ed3ad1bc6395..4538d8e03317b26dd8008234384299727989841a 100644 (file)
@@ -282,6 +282,19 @@ end:
        return ret;
 }
 
+enum ctf_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field)
+{
+       enum ctf_type_id ret = CTF_TYPE_UNKNOWN;
+
+       if (!field) {
+               goto end;
+       }
+
+       ret = bt_ctf_field_type_get_type_id(field->type);
+end:
+       return ret;
+}
+
 struct bt_ctf_field *bt_ctf_field_sequence_get_length(
                struct bt_ctf_field *field)
 {
index 2b682bb649d90c28e53f7c21d507b49628cbb31a..a1e1351aae2dc648b510503d20133117917fff7e 100644 (file)
@@ -352,6 +352,20 @@ extern int bt_ctf_field_string_append_len(
 extern struct bt_ctf_field_type *bt_ctf_field_get_type(
                struct bt_ctf_field *field);
 
+/*
+ * bt_ctf_field_get_type_id: get a field's ctf_type_id.
+ *
+ * This is a helper function which avoids a call to
+ * bt_ctf_field_get_type(), followed by a call to
+ * bt_ctf_field_type_get_type_id(), followed by a call to
+ * bt_ctf_put().
+ *
+ * @param field Field instance.
+ *
+ * Returns the field's ctf_type_id, CTF_TYPE_UNKNOWN on error.
+ */
+extern enum ctf_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field);
+
 /*
  * bt_ctf_field_copy: get a field's deep copy.
  *
This page took 0.025584 seconds and 4 git commands to generate.