util/FormatString: remove unused library
This commit is contained in:
parent
dfc5b4972b
commit
1f56960c44
@ -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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
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;
|
||||
}
|
@ -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 <cstdarg>
|
||||
|
||||
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
|
@ -11,7 +11,6 @@ util = static_library(
|
||||
'WStringCompare.cxx',
|
||||
'DivideString.cxx',
|
||||
'SplitString.cxx',
|
||||
'FormatString.cxx',
|
||||
'Tokenizer.cxx',
|
||||
'UriExtract.cxx',
|
||||
'UriQueryParser.cxx',
|
||||
|
Loading…
Reference in New Issue
Block a user