src.ctf.fs: use std::string in path_is_ctf_trace
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 9 Jun 2022 15:32:46 +0000 (11:32 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 17 Apr 2024 17:57:53 +0000 (13:57 -0400)
Change-Id: I796d135f7daee29a4481e61cf073e8bbd2e0f05f
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8292
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12329
Tested-by: jenkins <jenkins@lttng.org>
src/plugins/ctf/fs-src/fs.cpp

index b915c8b444ca936c7ed4199fc4ddf3e4f28ad560..431809069c760fd67050ea2b89d12d88c8aaf5a1 100644 (file)
@@ -761,24 +761,8 @@ end:
 
 static int path_is_ctf_trace(const char *path)
 {
-    GString *metadata_path = g_string_new(NULL);
-    int ret = 0;
-
-    if (!metadata_path) {
-        ret = -1;
-        goto end;
-    }
-
-    g_string_printf(metadata_path, "%s" G_DIR_SEPARATOR_S "%s", path, CTF_FS_METADATA_FILENAME);
-
-    if (g_file_test(metadata_path->str, G_FILE_TEST_IS_REGULAR)) {
-        ret = 1;
-        goto end;
-    }
-
-end:
-    g_string_free(metadata_path, TRUE);
-    return ret;
+    return g_file_test(fmt::format("{}" G_DIR_SEPARATOR_S CTF_FS_METADATA_FILENAME, path).c_str(),
+                       G_FILE_TEST_IS_REGULAR);
 }
 
 /* Helper for ctf_fs_component_create_ctf_fs_trace, to handle a single path. */
This page took 0.024769 seconds and 4 git commands to generate.