int ret;
bt2_common::GCharUP directory;
bt2_common::GCharUP basename;
- GString *index_basename = NULL;
+ std::string index_basename;
bt2_common::GCharUP index_file_path;
GMappedFile *mapped_file = NULL;
gsize filesize;
goto error;
}
- index_basename = g_string_new(basename.get());
- if (!index_basename) {
- BT_CLOGE_STR("Cannot allocate index file basename string");
- goto error;
- }
+ index_basename = basename.get();
+ index_basename += ".idx";
- g_string_append(index_basename, ".idx");
- index_file_path.reset(g_build_filename(directory.get(), "index", index_basename->str, NULL));
+ index_file_path.reset(g_build_filename(directory.get(), "index", index_basename.c_str(), NULL));
mapped_file = g_mapped_file_new(index_file_path.get(), FALSE, NULL);
if (!mapped_file) {
BT_CLOGD("Cannot create new mapped file %s", index_file_path.get());
goto error;
}
end:
- if (index_basename) {
- g_string_free(index_basename, TRUE);
- }
if (mapped_file) {
g_mapped_file_unref(mapped_file);
}