(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

@@ -81,10 +81,10 @@ static void UpdateElement(StoryPageElement &pe, TileIndex tile, uint32 reference
{
switch (pe.type) {
case SPET_TEXT:
pe.text = strdup(text);
pe.text = stredup(text);
break;
case SPET_LOCATION:
pe.text = strdup(text);
pe.text = stredup(text);
pe.referenced_id = tile;
break;
case SPET_GOAL:
@@ -126,7 +126,7 @@ CommandCost CmdCreateStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, u
if (StrEmpty(text)) {
s->title = NULL;
} else {
s->title = strdup(text);
s->title = stredup(text);
}
InvalidateWindowClassesData(WC_STORY_BOOK, -1);
@@ -243,7 +243,7 @@ CommandCost CmdSetStoryPageTitle(TileIndex tile, DoCommandFlag flags, uint32 p1,
if (StrEmpty(text)) {
p->title = NULL;
} else {
p->title = strdup(text);
p->title = stredup(text);
}
InvalidateWindowClassesData(WC_STORY_BOOK, page_id);