diff options
author | rubidium <rubidium@openttd.org> | 2014-04-25 15:40:32 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2014-04-25 15:40:32 +0000 |
commit | 9ed12b0f07edb342aaff21c130d325fd158a9d5b (patch) | |
tree | f42aa775396b4ebda4d119f76e80a77c180936c7 /src/script/script_info.cpp | |
parent | 4227f495c51ea909707505ec2ef1c730a382965d (diff) | |
download | openttd-9ed12b0f07edb342aaff21c130d325fd158a9d5b.tar.xz |
(svn r26509) -Codechange: replace strdup with stredup (the latter ensures the return is not NULL)
Diffstat (limited to 'src/script/script_info.cpp')
-rw-r--r-- | src/script/script_info.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/script/script_info.cpp b/src/script/script_info.cpp index 27bcec1eb..83d3bab8a 100644 --- a/src/script/script_info.cpp +++ b/src/script/script_info.cpp @@ -83,9 +83,9 @@ bool ScriptInfo::CheckMethod(const char *name) const } /* Get location information of the scanner */ - info->main_script = strdup(info->scanner->GetMainScript()); + info->main_script = stredup(info->scanner->GetMainScript()); const char *tar_name = info->scanner->GetTarFile(); - if (tar_name != NULL) info->tar_file = strdup(tar_name); + if (tar_name != NULL) info->tar_file = stredup(tar_name); /* Cache the data the info file gives us. */ if (!info->engine->CallStringMethodStrdup(*info->SQ_instance, "GetAuthor", &info->author, MAX_GET_OPS)) return SQ_ERROR; @@ -133,7 +133,7 @@ SQInteger ScriptInfo::AddSetting(HSQUIRRELVM vm) if (strcmp(key, "name") == 0) { const SQChar *sqvalue; if (SQ_FAILED(sq_getstring(vm, -1, &sqvalue))) return SQ_ERROR; - char *name = strdup(SQ2OTTD(sqvalue)); + char *name = stredup(SQ2OTTD(sqvalue)); char *s; ValidateString(name); @@ -146,7 +146,7 @@ SQInteger ScriptInfo::AddSetting(HSQUIRRELVM vm) } else if (strcmp(key, "description") == 0) { const SQChar *sqdescription; if (SQ_FAILED(sq_getstring(vm, -1, &sqdescription))) return SQ_ERROR; - config.description = strdup(SQ2OTTD(sqdescription)); + config.description = stredup(SQ2OTTD(sqdescription)); ValidateString(config.description); items |= 0x002; } else if (strcmp(key, "min_value") == 0) { @@ -264,8 +264,8 @@ SQInteger ScriptInfo::AddLabels(HSQUIRRELVM vm) const char *label = SQ2OTTD(sq_label); ValidateString(label); - /* !Contains() prevents strdup from leaking. */ - if (!config->labels->Contains(key)) config->labels->Insert(key, strdup(label)); + /* !Contains() prevents stredup from leaking. */ + if (!config->labels->Contains(key)) config->labels->Insert(key, stredup(label)); sq_pop(vm, 2); } |