summaryrefslogtreecommitdiffstats
path: root/src/StringUtils.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-05-04 20:21:48 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-07-23 01:32:47 +0200
commit330626ab22fe2e87afa5306c5f4039088c41b49e (patch)
tree86a5c7e0f0eb34743d186cbd712d368fed16f748 /src/StringUtils.cpp
parentRemove some unused inclusions (diff)
downloadcuberite-330626ab22fe2e87afa5306c5f4039088c41b49e.tar
cuberite-330626ab22fe2e87afa5306c5f4039088c41b49e.tar.gz
cuberite-330626ab22fe2e87afa5306c5f4039088c41b49e.tar.bz2
cuberite-330626ab22fe2e87afa5306c5f4039088c41b49e.tar.lz
cuberite-330626ab22fe2e87afa5306c5f4039088c41b49e.tar.xz
cuberite-330626ab22fe2e87afa5306c5f4039088c41b49e.tar.zst
cuberite-330626ab22fe2e87afa5306c5f4039088c41b49e.zip
Diffstat (limited to 'src/StringUtils.cpp')
-rw-r--r--src/StringUtils.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp
index fc19decb3..e6fbcc6fe 100644
--- a/src/StringUtils.cpp
+++ b/src/StringUtils.cpp
@@ -52,34 +52,34 @@ static unsigned char HexToDec(char a_HexChar)
-AString & vPrintf(AString & str, const char * format, fmt::printf_args args)
+AString & vPrintf(AString & a_String, const char * a_Format, fmt::printf_args a_ArgList)
{
- ASSERT(format != nullptr);
- fmt::memory_buffer Buffer;
- fmt::vprintf(Buffer, fmt::to_string_view(format), args);
- str.assign(Buffer.data(), Buffer.size());
- return str;
+ ASSERT(a_Format != nullptr);
+ fmt::memory_buffer Buffer; // Save a string allocation compared to vsprintf
+ fmt::vprintf(Buffer, fmt::to_string_view(a_Format), a_ArgList);
+ a_String.assign(Buffer.data(), Buffer.size());
+ return a_String;
}
-AString vPrintf(const char * format, fmt::printf_args args)
+AString vPrintf(const char * a_Format, fmt::printf_args a_ArgList)
{
- ASSERT(format != nullptr);
- return fmt::vsprintf(format, args);
+ ASSERT(a_Format != nullptr);
+ return fmt::vsprintf(a_Format, a_ArgList);
}
-AString & vAppendPrintf(AString & a_String, const char * format, fmt::printf_args args)
+AString & vAppendPrintf(AString & a_String, const char * a_Format, fmt::printf_args a_ArgList)
{
- ASSERT(format != nullptr);
+ ASSERT(a_Format != nullptr);
fmt::memory_buffer Buffer;
- fmt::vprintf(Buffer, fmt::to_string_view(format), args);
+ fmt::vprintf(Buffer, fmt::to_string_view(a_Format), a_ArgList);
a_String.append(Buffer.data(), Buffer.size());
return a_String;
}