diff options
author | rubidium <rubidium@openttd.org> | 2014-04-24 18:37:39 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2014-04-24 18:37:39 +0000 |
commit | 8960939b22a474f42575b415f06c09eac7ff92fc (patch) | |
tree | 2748f648244486593c4874160fb10fc5218c9b84 /src/game | |
parent | 382ca0941fe53db8d01e145cff12bed91f51aaea (diff) | |
download | openttd-8960939b22a474f42575b415f06c09eac7ff92fc.tar.xz |
(svn r26499) -Codechange: replace strndup with stredup
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/game_text.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/game/game_text.cpp b/src/game/game_text.cpp index 502869249..bfff460ae 100644 --- a/src/game/game_text.cpp +++ b/src/game/game_text.cpp @@ -66,7 +66,7 @@ void NORETURN CDECL strgen_fatal(const char *s, ...) */ LanguageStrings::LanguageStrings(const char *language, const char *end) { - this->language = end == NULL ? strdup(language) : strndup(language, end - language); + this->language = stredup(language, end - 1); } /** Free everything. */ @@ -115,7 +115,7 @@ LanguageStrings *ReadRawLanguageStrings(const char *file) while (i > 0 && (buffer[i - 1] == '\r' || buffer[i - 1] == '\n' || buffer[i - 1] == ' ')) i--; buffer[i] = '\0'; - *ret->lines.Append() = strndup(buffer, to_read); + *ret->lines.Append() = stredup(buffer, buffer + to_read - 1); if (len > to_read) { to_read = 0; |