util/StringFormat: new utility library

This commit is contained in:
Max Kellermann
2018-01-24 12:52:43 +01:00
parent 41cdc4e14b
commit 60d5bf0240
14 changed files with 132 additions and 82 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)
{
#ifdef HAVE_THREAD_NAME
char buffer[16];
snprintf(buffer, sizeof(buffer), fmt, args...);
SetThreadName(buffer);
SetThreadName(StringFormat<16>(fmt, args...));
#else
(void)fmt;
#endif