}
/* Set path to stream file. */
- index_entry->path = file_info->path->str;
+ index_entry->path = file_info->path.c_str();
index_entry->timestamp_begin = be64toh(file_index->timestamp_begin);
index_entry->timestamp_end = be64toh(file_index->timestamp_end);
}
/* Set path to stream file. */
- index_entry->path = file_info->path->str;
+ index_entry->path = file_info->path.c_str();
ret = init_index_entry(index_entry, ds_file, &props);
if (ret) {
return;
}
- if (ds_file_info->path) {
- g_string_free(ds_file_info->path, TRUE);
- }
-
delete ds_file_info;
}
struct ctf_fs_ds_file_info *ctf_fs_ds_file_info_create(const char *path, int64_t begin_ns)
{
ctf_fs_ds_file_info *ds_file_info = new ctf_fs_ds_file_info;
- ds_file_info->path = g_string_new(path);
- if (!ds_file_info->path) {
- ctf_fs_ds_file_info_destroy(ds_file_info);
- ds_file_info = NULL;
- goto end;
- }
+ ds_file_info->path = path;
ds_file_info->begin_ns = begin_ns;
-
-end:
return ds_file_info;
}
#define CTF_FS_DS_FILE_H
#include <memory>
+#include <string>
#include <glib.h>
#include <stdio.h>
struct ctf_fs_ds_file_info
{
- /* Owned by this. */
- GString *path = nullptr;
+ std::string path;
/* Guaranteed to be set, as opposed to the index. */
int64_t begin_ns = 0;
BT_ASSERT(ds_file_group->ds_file_infos->len == 1);
struct ctf_fs_ds_file_info *ds_file_info =
(struct ctf_fs_ds_file_info *) g_ptr_array_index(ds_file_group->ds_file_infos, 0);
- g_string_append_printf(name, " | %s", ds_file_info->path->str);
+ g_string_append_printf(name, " | %s", ds_file_info->path.c_str());
}
return bt2c::GCharUP {g_string_free(name, FALSE)};
const ctf_fs_ds_file_info *first_ds_file_info_b =
(const ctf_fs_ds_file_info *) ds_file_group_b->ds_file_infos->pdata[0];
- return strcmp(first_ds_file_info_a->path->str, first_ds_file_info_b->path->str) < 0;
+ return first_ds_file_info_a->path < first_ds_file_info_b->path;
}
static gint compare_strings(gconstpointer p_a, gconstpointer p_b)
*/
BT_ASSERT(ds_file_group->ds_file_infos->len > 0);
ds_file_info = (ctf_fs_ds_file_info *) g_ptr_array_index(ds_file_group->ds_file_infos, 0);
- g_string_assign(name, ds_file_info->path->str);
+ g_string_assign(name, ds_file_info->path.c_str());
end:
return name;