summaryrefslogtreecommitdiff
path: root/src/newgrf_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/newgrf_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/newgrf_config.cpp')
-rw-r--r--src/newgrf_config.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index 9250ce748..eb6322e32 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -50,7 +50,7 @@ GRFConfig::GRFConfig(const char *filename) :
url(new GRFTextWrapper()),
num_valid_params(lengthof(param))
{
- if (filename != NULL) this->filename = strdup(filename);
+ if (filename != NULL) this->filename = stredup(filename);
this->name->AddRef();
this->info->AddRef();
this->url->AddRef();
@@ -78,7 +78,7 @@ GRFConfig::GRFConfig(const GRFConfig &config) :
{
MemCpyT<uint8>(this->original_md5sum, config.original_md5sum, lengthof(this->original_md5sum));
MemCpyT<uint32>(this->param, config.param, lengthof(this->param));
- if (config.filename != NULL) this->filename = strdup(config.filename);
+ if (config.filename != NULL) this->filename = stredup(config.filename);
this->name->AddRef();
this->info->AddRef();
this->url->AddRef();
@@ -95,7 +95,7 @@ GRFConfig::GRFConfig(const GRFConfig &config) :
/** Cleanup a GRFConfig object. */
GRFConfig::~GRFConfig()
{
- /* GCF_COPY as in NOT strdupped/alloced the filename */
+ /* GCF_COPY as in NOT stredupped/alloced the filename */
if (!HasBit(this->flags, GCF_COPY)) {
free(this->filename);
delete this->error;
@@ -204,8 +204,8 @@ GRFError::GRFError(const GRFError &error) :
message(error.message),
severity(error.severity)
{
- if (error.custom_message != NULL) this->custom_message = strdup(error.custom_message);
- if (error.data != NULL) this->data = strdup(error.data);
+ if (error.custom_message != NULL) this->custom_message = stredup(error.custom_message);
+ if (error.data != NULL) this->data = stredup(error.data);
memcpy(this->param_value, error.param_value, sizeof(this->param_value));
}
@@ -584,7 +584,7 @@ compatible_grf:
* already a local one, so there is no need to replace it. */
if (!HasBit(c->flags, GCF_COPY)) {
free(c->filename);
- c->filename = strdup(f->filename);
+ c->filename = stredup(f->filename);
memcpy(c->ident.md5sum, f->ident.md5sum, sizeof(c->ident.md5sum));
c->name->Release();
c->name = f->name;