From: Simon Marchi Date: Thu, 9 Jun 2022 15:32:46 +0000 (-0400) Subject: src.ctf.fs: use std::string in path_is_ctf_trace X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=8bf95988b35fcf6c6922b8f344584d83829beff1 src.ctf.fs: use std::string in path_is_ctf_trace Change-Id: I796d135f7daee29a4481e61cf073e8bbd2e0f05f Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/8292 Reviewed-by: Philippe Proulx Reviewed-on: https://review.lttng.org/c/babeltrace/+/12329 Tested-by: jenkins --- diff --git a/src/plugins/ctf/fs-src/fs.cpp b/src/plugins/ctf/fs-src/fs.cpp index b915c8b4..43180906 100644 --- a/src/plugins/ctf/fs-src/fs.cpp +++ b/src/plugins/ctf/fs-src/fs.cpp @@ -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. */