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>
Tue, 23 Aug 2022 16:06:16 +0000 (12:06 -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>
src/plugins/ctf/fs-src/fs.cpp

index 4e0fb27b8e8a46b0e187d5cc0fc09b06161aa3bd..87a641b784470749217c7ed5eee34ad48c840517 100644 (file)
@@ -776,23 +776,18 @@ 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);
+    std::string metadata_path = path;
+    metadata_path += G_DIR_SEPARATOR;
+    metadata_path += CTF_FS_METADATA_FILENAME;
 
-    if (g_file_test(metadata_path->str, G_FILE_TEST_IS_REGULAR)) {
+    if (g_file_test(metadata_path.c_str(), G_FILE_TEST_IS_REGULAR)) {
         ret = 1;
         goto end;
     }
 
 end:
-    g_string_free(metadata_path, TRUE);
     return ret;
 }
 
This page took 0.025899 seconds and 5 git commands to generate.