summaryrefslogtreecommitdiff
path: root/src/script/script_config.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/script/script_config.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/script/script_config.cpp')
-rw-r--r--src/script/script_config.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/script/script_config.cpp b/src/script/script_config.cpp
index 768ff5e21..a6e41476e 100644
--- a/src/script/script_config.cpp
+++ b/src/script/script_config.cpp
@@ -21,7 +21,7 @@
void ScriptConfig::Change(const char *name, int version, bool force_exact_match, bool is_random)
{
free(this->name);
- this->name = (name == NULL) ? NULL : strdup(name);
+ this->name = (name == NULL) ? NULL : stredup(name);
this->info = (name == NULL) ? NULL : this->FindInfo(this->name, version, force_exact_match);
this->version = (info == NULL) ? -1 : info->GetVersion();
this->is_random = is_random;
@@ -45,14 +45,14 @@ void ScriptConfig::Change(const char *name, int version, bool force_exact_match,
ScriptConfig::ScriptConfig(const ScriptConfig *config)
{
- this->name = (config->name == NULL) ? NULL : strdup(config->name);
+ this->name = (config->name == NULL) ? NULL : stredup(config->name);
this->info = config->info;
this->version = config->version;
this->config_list = NULL;
this->is_random = config->is_random;
for (SettingValueList::const_iterator it = config->settings.begin(); it != config->settings.end(); it++) {
- this->settings[strdup((*it).first)] = (*it).second;
+ this->settings[stredup((*it).first)] = (*it).second;
}
this->AddRandomDeviation();
}
@@ -117,7 +117,7 @@ void ScriptConfig::SetSetting(const char *name, int value)
if (it != this->settings.end()) {
(*it).second = value;
} else {
- this->settings[strdup(name)] = value;
+ this->settings[stredup(name)] = value;
}
}
@@ -160,7 +160,7 @@ int ScriptConfig::GetVersion() const
void ScriptConfig::StringToSettings(const char *value)
{
- char *value_copy = strdup(value);
+ char *value_copy = stredup(value);
char *s = value_copy;
while (s != NULL) {