From 8960939b22a474f42575b415f06c09eac7ff92fc Mon Sep 17 00:00:00 2001 From: rubidium Date: Thu, 24 Apr 2014 18:37:39 +0000 Subject: (svn r26499) -Codechange: replace strndup with stredup --- src/game/game_text.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/game') 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; -- cgit v1.2.3-70-g09d2