src.ctf.fs: make set_trace_name use bt2::Trace
authorSimon Marchi <simon.marchi@efficios.com>
Sun, 19 Jun 2022 03:21:00 +0000 (23:21 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 23 Aug 2022 16:06:16 +0000 (12:06 -0400)
Change-Id: I3f47878658a431f81a129fc9e644efe50608e7ce
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8418
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/plugins/ctf/fs-src/fs.cpp

index 9e025566e8e3052ae30267c08930c6e1079d8541..933986515c300c906d2a9d918155980b7fd88171 100644 (file)
@@ -603,8 +603,8 @@ static int create_ds_file_groups(struct ctf_fs_trace *ctf_fs_trace)
     return 0;
 }
 
-static int set_trace_name(bt_trace *trace, const char *name_suffix,
-                          const bt2_common::LogCfg& logCfg)
+static void set_trace_name(bt2::Trace trace, const char *name_suffix,
+                           const bt2_common::LogCfg& logCfg)
 {
     std::string name;
 
@@ -612,9 +612,9 @@ static int set_trace_name(bt_trace *trace, const char *name_suffix,
      * Check if we have a trace environment string value named `hostname`.
      * If so, use it as the trace name's prefix.
      */
-    const bt_value *val = bt_trace_borrow_environment_entry_value_by_name_const(trace, "hostname");
-    if (val && bt_value_is_string(val)) {
-        name += bt_value_string_get(val);
+    nonstd::optional<bt2::ConstValue> val = trace.environmentEntry("hostname");
+    if (val && val->isString()) {
+        name += val->asString().value().c_str();
 
         if (name_suffix) {
             name += G_DIR_SEPARATOR;
@@ -625,7 +625,7 @@ static int set_trace_name(bt_trace *trace, const char *name_suffix,
         name += name_suffix;
     }
 
-    return bt_trace_set_name(trace, name.c_str());
+    trace.name(name);
 }
 
 static ctf_fs_trace::UP ctf_fs_trace_create(const char *path, const char *name,
@@ -653,10 +653,7 @@ static ctf_fs_trace::UP ctf_fs_trace_create(const char *path, const char *name,
     if (ctf_fs_trace->trace) {
         ctf_trace_class_configure_ir_trace(ctf_fs_trace->metadata->tc, **ctf_fs_trace->trace);
 
-        ret = set_trace_name((*ctf_fs_trace->trace)->libObjPtr(), name, logCfg);
-        if (ret) {
-            return nullptr;
-        }
+        set_trace_name(**ctf_fs_trace->trace, name, logCfg);
     }
 
     ret = create_ds_file_groups(ctf_fs_trace.get());
This page took 0.025839 seconds and 5 git commands to generate.