summaryrefslogtreecommitdiff
path: root/src/console.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2014-04-25 15:40:32 +0000
committerrubidium <rubidium@openttd.org>2014-04-25 15:40:32 +0000
commit9ed12b0f07edb342aaff21c130d325fd158a9d5b (patch)
treef42aa775396b4ebda4d119f76e80a77c180936c7 /src/console.cpp
parent4227f495c51ea909707505ec2ef1c730a382965d (diff)
downloadopenttd-9ed12b0f07edb342aaff21c130d325fd158a9d5b.tar.xz
(svn r26509) -Codechange: replace strdup with stredup (the latter ensures the return is not NULL)
Diffstat (limited to 'src/console.cpp')
-rw-r--r--src/console.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/console.cpp b/src/console.cpp
index 2274da64f..511019281 100644
--- a/src/console.cpp
+++ b/src/console.cpp
@@ -105,7 +105,7 @@ void IConsolePrint(TextColour colour_code, const char *string)
/* Create a copy of the string, strip if of colours and invalid
* characters and (when applicable) assign it to the console buffer */
- str = strdup(string);
+ str = stredup(string);
str_strip_colours(str);
str_validate(str, str + strlen(str));
@@ -256,7 +256,7 @@ char *RemoveUnderscores(char *name)
void IConsoleCmdRegister(const char *name, IConsoleCmdProc *proc, IConsoleHook *hook)
{
IConsoleCmd *item_new = MallocT<IConsoleCmd>(1);
- item_new->name = RemoveUnderscores(strdup(name));
+ item_new->name = RemoveUnderscores(stredup(name));
item_new->next = NULL;
item_new->proc = proc;
item_new->hook = hook;
@@ -291,8 +291,8 @@ void IConsoleAliasRegister(const char *name, const char *cmd)
return;
}
- char *new_alias = RemoveUnderscores(strdup(name));
- char *cmd_aliased = strdup(cmd);
+ char *new_alias = RemoveUnderscores(stredup(name));
+ char *cmd_aliased = stredup(cmd);
IConsoleAlias *item_new = MallocT<IConsoleAlias>(1);
item_new->next = NULL;