Reapply "pmt: use constructor/destructor attributes insetad of class"
This reverts commit d4703df1a5.
This commit is contained in:
@@ -70,17 +70,6 @@ public:
|
|||||||
bool forceProcess;
|
bool forceProcess;
|
||||||
};
|
};
|
||||||
|
|
||||||
class variableProtect final {
|
|
||||||
private:
|
|
||||||
basic_variables *_ptr = nullptr;
|
|
||||||
|
|
||||||
public:
|
|
||||||
variableProtect();
|
|
||||||
~variableProtect();
|
|
||||||
|
|
||||||
void setVariablePointer(basic_variables *&_ptr);
|
|
||||||
};
|
|
||||||
|
|
||||||
using FunctionBase = basic_function;
|
using FunctionBase = basic_function;
|
||||||
using FunctionManager = basic_function_manager;
|
using FunctionManager = basic_function_manager;
|
||||||
using VariableTable = basic_variables;
|
using VariableTable = basic_variables;
|
||||||
|
|||||||
@@ -24,17 +24,19 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
namespace PartitionManager {
|
namespace PartitionManager {
|
||||||
variableProtect protector;
|
|
||||||
auto Variables = new VariableTable();
|
|
||||||
|
|
||||||
variableProtect::variableProtect() {
|
__attribute__((constructor))
|
||||||
|
void init() {
|
||||||
Helper::LoggingProperties::setLogFile("/sdcard/Documents/last_pmt_logs.log");
|
Helper::LoggingProperties::setLogFile("/sdcard/Documents/last_pmt_logs.log");
|
||||||
}
|
}
|
||||||
variableProtect::~variableProtect() { delete _ptr; }
|
|
||||||
void variableProtect::setVariablePointer(basic_variables *&_ptr) {
|
__attribute__((destructor))
|
||||||
this->_ptr = _ptr;
|
void cleanup() {
|
||||||
|
delete Variables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto Variables = new VariableTable();
|
||||||
|
|
||||||
basic_variables::~basic_variables() { delete PartMap; }
|
basic_variables::~basic_variables() { delete PartMap; }
|
||||||
basic_variables::basic_variables()
|
basic_variables::basic_variables()
|
||||||
: logFile(Helper::LoggingProperties::FILE), onLogical(false),
|
: logFile(Helper::LoggingProperties::FILE), onLogical(false),
|
||||||
@@ -50,7 +52,6 @@ int Main(int argc, char **argv) {
|
|||||||
try {
|
try {
|
||||||
// try-catch start
|
// try-catch start
|
||||||
CLI::App AppMain{"Partition Manager Tool"};
|
CLI::App AppMain{"Partition Manager Tool"};
|
||||||
protector.setVariablePointer(Variables);
|
|
||||||
FunctionManager FuncManager;
|
FunctionManager FuncManager;
|
||||||
|
|
||||||
AppMain.fallthrough(true);
|
AppMain.fallthrough(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user