Codechange: use std::string instead of stredup/free for goals

This commit is contained in:
Rubidium
2023-04-27 19:03:03 +02:00
committed by rubidium42
parent cc44aa7438
commit 3342967ad9
5 changed files with 27 additions and 38 deletions

View File

@@ -19,12 +19,12 @@ extern GoalPool _goal_pool;
/** Struct about goals, current and completed */
struct Goal : GoalPool::PoolItem<&_goal_pool> {
CompanyID company; ///< Goal is for a specific company; INVALID_COMPANY if it is global
GoalType type; ///< Type of the goal
GoalTypeID dst; ///< Index of type
char *text; ///< Text of the goal.
char *progress; ///< Progress text of the goal.
bool completed; ///< Is the goal completed or not?
CompanyID company; ///< Goal is for a specific company; INVALID_COMPANY if it is global
GoalType type; ///< Type of the goal
GoalTypeID dst; ///< Index of type
std::string text; ///< Text of the goal.
std::string progress; ///< Progress text of the goal.
bool completed; ///< Is the goal completed or not?
/**
* We need an (empty) constructor so struct isn't zeroed (as C++ standard states)
@@ -34,7 +34,7 @@ struct Goal : GoalPool::PoolItem<&_goal_pool> {
/**
* (Empty) destructor has to be defined else operator delete might be called with nullptr parameter
*/
inline ~Goal() { free(this->text); free(this->progress); }
inline ~Goal() { }
};
#endif /* GOAL_BASE_H */