(svn r26509) -Codechange: replace strdup with stredup (the latter ensures the return is not NULL)

This commit is contained in:
rubidium
2014-04-25 15:40:32 +00:00
parent 4227f495c5
commit 9ed12b0f07
70 changed files with 207 additions and 183 deletions

View File

@@ -90,7 +90,7 @@ CommandCost CmdCreateGoal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
g->type = type;
g->dst = p2;
g->company = company;
g->text = strdup(text);
g->text = stredup(text);
g->progress = NULL;
g->completed = false;
@@ -155,7 +155,7 @@ CommandCost CmdSetGoalText(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
if (flags & DC_EXEC) {
Goal *g = Goal::Get(p1);
free(g->text);
g->text = strdup(text);
g->text = stredup(text);
if (g->company == INVALID_COMPANY) {
InvalidateWindowClassesData(WC_GOALS_LIST);
@@ -187,7 +187,7 @@ CommandCost CmdSetGoalProgress(TileIndex tile, DoCommandFlag flags, uint32 p1, u
if (StrEmpty(text)) {
g->progress = NULL;
} else {
g->progress = strdup(text);
g->progress = stredup(text);
}
if (g->company == INVALID_COMPANY) {