src.ctf.fs: use std::string in path_is_ctf_trace
[babeltrace.git] / 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.023576 seconds and 4 git commands to generate.