Re-format new C++ files
[babeltrace.git] / src / plugins / ctf / common / metadata / ctf-meta-configure-ir-trace.cpp
1 /*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
5 */
6
7 #include <babeltrace2/babeltrace.h>
8
9 #include "ctf-meta-configure-ir-trace.hpp"
10
11 BT_HIDDEN
12 int ctf_trace_class_configure_ir_trace(struct ctf_trace_class *tc, bt_trace *ir_trace)
13 {
14 int ret = 0;
15 uint64_t i;
16
17 BT_ASSERT(tc);
18 BT_ASSERT(ir_trace);
19
20 if (tc->is_uuid_set) {
21 bt_trace_set_uuid(ir_trace, tc->uuid);
22 }
23
24 for (i = 0; i < tc->env_entries->len; i++) {
25 struct ctf_trace_class_env_entry *env_entry =
26 ctf_trace_class_borrow_env_entry_by_index(tc, i);
27
28 switch (env_entry->type) {
29 case CTF_TRACE_CLASS_ENV_ENTRY_TYPE_INT:
30 ret = bt_trace_set_environment_entry_integer(ir_trace, env_entry->name->str,
31 env_entry->value.i);
32 break;
33 case CTF_TRACE_CLASS_ENV_ENTRY_TYPE_STR:
34 ret = bt_trace_set_environment_entry_string(ir_trace, env_entry->name->str,
35 env_entry->value.str->str);
36 break;
37 default:
38 bt_common_abort();
39 }
40
41 if (ret) {
42 goto end;
43 }
44 }
45
46 end:
47 return ret;
48 }
This page took 0.0299 seconds and 4 git commands to generate.