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/squirrel_std.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/squirrel_std.cpp')
-rw-r--r-- | src/script/squirrel_std.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/script/squirrel_std.cpp b/src/script/squirrel_std.cpp index f09471554..0fb8564c8 100644 --- a/src/script/squirrel_std.cpp +++ b/src/script/squirrel_std.cpp @@ -16,11 +16,13 @@ #include "squirrel_std.hpp" #include "../core/alloc_func.hpp" #include "../core/math_func.hpp" +#include "../string_func.h" /* Due to the different characters for Squirrel, the scstrcat might be a simple * strcat which triggers the safeguard. But it isn't always a simple strcat. */ #include "../safeguards.h" #undef strcat +#undef strdup SQInteger SquirrelStd::min(HSQUIRRELVM vm) @@ -71,7 +73,7 @@ SQInteger SquirrelStd::require(HSQUIRRELVM vm) real_filename = ReallocT(real_filename, scstrlen(real_filename) + scstrlen(filename) + 1); scstrcat(real_filename, filename); /* Tars dislike opening files with '/' on Windows.. so convert it to '\\' ;) */ - char *filen = strdup(SQ2OTTD(real_filename)); + char *filen = stredup(SQ2OTTD(real_filename)); #if (PATHSEPCHAR != '/') for (char *n = filen; *n != '\0'; n++) if (*n == '/') *n = PATHSEPCHAR; #endif |