From 9ed12b0f07edb342aaff21c130d325fd158a9d5b Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 25 Apr 2014 15:40:32 +0000 Subject: (svn r26509) -Codechange: replace strdup with stredup (the latter ensures the return is not NULL) --- src/script/script_scanner.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/script/script_scanner.cpp') diff --git a/src/script/script_scanner.cpp b/src/script/script_scanner.cpp index 3796aafd5..98bc1f385 100644 --- a/src/script/script_scanner.cpp +++ b/src/script/script_scanner.cpp @@ -29,12 +29,12 @@ bool ScriptScanner::AddFile(const char *filename, size_t basepath_length, const char *tar_filename) { free(this->main_script); - this->main_script = strdup(filename); + this->main_script = stredup(filename); if (this->main_script == NULL) return false; free(this->tar_file); if (tar_filename != NULL) { - this->tar_file = strdup(tar_filename); + this->tar_file = stredup(tar_filename); if (this->tar_file == NULL) return false; } else { this->tar_file = NULL; @@ -150,13 +150,13 @@ void ScriptScanner::RegisterScript(ScriptInfo *info) return; } - this->info_list[strdup(script_name)] = info; + this->info_list[stredup(script_name)] = info; if (!info->IsDeveloperOnly() || _settings_client.gui.ai_developer_tools) { /* Add the script to the 'unique' script list, where only the highest version * of the script is registered. */ if (this->info_single_list.find(script_original_name) == this->info_single_list.end()) { - this->info_single_list[strdup(script_original_name)] = info; + this->info_single_list[stredup(script_original_name)] = info; } else if (this->info_single_list[script_original_name]->GetVersion() < info->GetVersion()) { this->info_single_list[script_original_name] = info; } -- cgit v1.2.3-54-g00ecf