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/ai/ai_info.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/ai/ai_info.cpp') diff --git a/src/ai/ai_info.cpp b/src/ai/ai_info.cpp index 9c9f3b47e..e048a5457 100644 --- a/src/ai/ai_info.cpp +++ b/src/ai/ai_info.cpp @@ -15,6 +15,7 @@ #include "ai_info.hpp" #include "ai_scanner.hpp" #include "../debug.h" +#include "../string_func.h" #include "../rev.h" #include "../safeguards.h" @@ -71,8 +72,8 @@ template <> const char *GetClassName() { return "AIInfo"; } if (res != 0) return res; ScriptConfigItem config = _start_date_config; - config.name = strdup(config.name); - config.description = strdup(config.description); + config.name = stredup(config.name); + config.description = stredup(config.description); info->config_list.push_front(config); if (info->engine->MethodExists(*info->SQ_instance, "MinVersionToLoad")) { @@ -94,7 +95,7 @@ template <> const char *GetClassName() { return "AIInfo"; } return SQ_ERROR; } } else { - info->api_version = strdup("0.7"); + info->api_version = stredup("0.7"); } /* Remove the link to the real instance, else it might get deleted by RegisterAI() */ @@ -117,7 +118,7 @@ template <> const char *GetClassName() { return "AIInfo"; } char buf[8]; seprintf(buf, lastof(buf), "%d.%d", GB(_openttd_newgrf_version, 28, 4), GB(_openttd_newgrf_version, 24, 4)); - info->api_version = strdup(buf); + info->api_version = stredup(buf); /* Remove the link to the real instance, else it might get deleted by RegisterAI() */ sq_setinstanceup(vm, 2, NULL); -- cgit v1.2.3-70-g09d2