util/StringUtil: move CopyString() to TruncateString.cxx

This commit is contained in:
Max Kellermann
2017-07-05 17:11:34 +02:00
parent b04679b429
commit 4b94ae8040
9 changed files with 101 additions and 31 deletions

View File

@@ -21,24 +21,9 @@
#include "CharUtil.hxx"
#include "ASCII.hxx"
#include <algorithm>
#include <assert.h>
#include <string.h>
char *
CopyString(char *gcc_restrict dest, const char *gcc_restrict src,
size_t size) noexcept
{
size_t length = strlen(src);
if (length >= size)
length = size - 1;
char *p = std::copy_n(src, length, dest);
*p = '\0';
return p;
}
const char *
StripLeft(const char *p) noexcept
{