diff --git a/src/util/FormatString.cxx b/src/util/FormatString.cxx deleted file mode 100644 index 20a3f20fe..000000000 --- a/src/util/FormatString.cxx +++ /dev/null @@ -1,35 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -// Copyright The Music Player Daemon Project - -#include "FormatString.hxx" -#include "AllocatedString.hxx" - -#include -#include - -AllocatedString -FormatStringV(const char *fmt, std::va_list args) noexcept -{ - std::va_list tmp; - va_copy(tmp, args); - const int length = vsnprintf(nullptr, 0, fmt, tmp); - va_end(tmp); - - if (length <= 0) - /* wtf.. */ - abort(); - - char *buffer = new char[length + 1]; - vsnprintf(buffer, length + 1, fmt, args); - return AllocatedString::Donate(buffer); -} - -AllocatedString -FormatString(const char *fmt, ...) noexcept -{ - std::va_list args; - va_start(args, fmt); - auto p = FormatStringV(fmt, args); - va_end(args); - return p; -} diff --git a/src/util/FormatString.hxx b/src/util/FormatString.hxx deleted file mode 100644 index 3b0b039bc..000000000 --- a/src/util/FormatString.hxx +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -// Copyright The Music Player Daemon Project - -#ifndef MPD_FORMAT_STRING_HXX -#define MPD_FORMAT_STRING_HXX - -#include "Compiler.h" - -#include - -class AllocatedString; - -/** - * Format into an #AllocatedString. - */ -[[gnu::nonnull]] -AllocatedString -FormatStringV(const char *fmt, std::va_list args) noexcept; - -/** - * Format into an #AllocatedString. - */ -[[gnu::nonnull(1)]] -gcc_printf(1,2) -AllocatedString -FormatString(const char *fmt, ...) noexcept; - -#endif diff --git a/src/util/meson.build b/src/util/meson.build index 6fc6b89c0..0e41fc20d 100644 --- a/src/util/meson.build +++ b/src/util/meson.build @@ -11,7 +11,6 @@ util = static_library( 'WStringCompare.cxx', 'DivideString.cxx', 'SplitString.cxx', - 'FormatString.cxx', 'Tokenizer.cxx', 'UriExtract.cxx', 'UriQueryParser.cxx',