pmt: fix memory leaks, and improve info function
- Removed --no-write-test argument of memory test function - Fixed memory leak of memory test function - Improved info function with using nlohmann/json header-only library - Some other improvents
This commit is contained in:
@@ -81,14 +81,14 @@ private:
|
||||
std::vector<uint8_t *> _ptrs_u;
|
||||
std::vector<FILE *> _fps;
|
||||
std::vector<int> _fds;
|
||||
std::vector<std::string_view> _files;
|
||||
std::vector<std::string> _files;
|
||||
|
||||
public:
|
||||
~garbageCollector();
|
||||
|
||||
void delAfterProgress(char *&_ptr);
|
||||
void delAfterProgress(uint8_t *&_ptr);
|
||||
void delFileAfterProgress(std::string_view path);
|
||||
void delFileAfterProgress(const std::string& path);
|
||||
void closeAfterProgress(FILE *&_fp);
|
||||
void closeAfterProgress(int _fd);
|
||||
};
|
||||
|
||||
@@ -95,7 +95,7 @@ garbageCollector::~garbageCollector() {
|
||||
close(fd);
|
||||
for (const auto &fp : _fps)
|
||||
fclose(fp);
|
||||
for (const auto &file: _files)
|
||||
for (const auto &file : _files)
|
||||
eraseEntry(file);
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ void garbageCollector::delAfterProgress(char *&_ptr) {
|
||||
void garbageCollector::delAfterProgress(uint8_t *&_ptr) {
|
||||
_ptrs_u.push_back(_ptr);
|
||||
}
|
||||
void garbageCollector::delFileAfterProgress(const std::string_view path) {
|
||||
void garbageCollector::delFileAfterProgress(const std::string &path) {
|
||||
_files.push_back(path);
|
||||
}
|
||||
void garbageCollector::closeAfterProgress(const int _fd) {
|
||||
|
||||
@@ -118,6 +118,7 @@ public:
|
||||
[[nodiscard]] constant_iterator cend() const;
|
||||
};
|
||||
|
||||
using Partition_t = _entry;
|
||||
using Map_t = basic_partition_map;
|
||||
|
||||
class basic_partition_map_builder final {
|
||||
|
||||
@@ -47,7 +47,7 @@ bool basic_partition_map_builder::_is_real_block_dir(
|
||||
}
|
||||
|
||||
Map_t basic_partition_map_builder::_build_map(std::string_view path,
|
||||
bool logical) {
|
||||
const bool logical) {
|
||||
Map_t map;
|
||||
std::vector<std::filesystem::directory_entry> entries{
|
||||
std::filesystem::directory_iterator(path),
|
||||
|
||||
Reference in New Issue
Block a user