util/StringFormat: new utility library

This commit is contained in:
Max Kellermann
2018-01-24 12:52:43 +01:00
parent 4324fb2fbe
commit 97f670658f
15 changed files with 138 additions and 94 deletions

View File

@@ -31,7 +31,7 @@
#endif
#ifdef HAVE_THREAD_NAME
# include <stdio.h>
#include "util/StringFormat.hxx"
#endif
static inline void
@@ -59,9 +59,7 @@ static inline void
FormatThreadName(const char *fmt, gcc_unused Args&&... args) noexcept
{
#ifdef HAVE_THREAD_NAME
char buffer[16];
snprintf(buffer, sizeof(buffer), fmt, args...);
SetThreadName(buffer);
SetThreadName(StringFormat<16>(fmt, args...));
#else
(void)fmt;
#endif