lib/fmt: require libfmt 9

Version 9 added the "debug format" which I'd like to use.
This commit is contained in:
Max Kellermann
2024-04-16 11:31:07 +02:00
parent 08810991c2
commit 39c9e92f42
12 changed files with 7 additions and 103 deletions

View File

@@ -28,11 +28,7 @@ bool
Response::VFmt(fmt::string_view format_str, fmt::format_args args) noexcept
{
fmt::memory_buffer buffer;
#if FMT_VERSION >= 80000
fmt::vformat_to(std::back_inserter(buffer), format_str, args);
#else
fmt::vformat_to(buffer, format_str, args);
#endif
return Write(buffer.data(), buffer.size());
}

View File

@@ -1,15 +1,11 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright The Music Player Daemon Project
#ifndef MPD_RESPONSE_HXX
#define MPD_RESPONSE_HXX
#pragma once
#include "protocol/Ack.hxx"
#include <fmt/core.h>
#if FMT_VERSION >= 80000 && FMT_VERSION < 90000
#include <fmt/format.h>
#endif
#include <cstddef>
#include <span>
@@ -66,14 +62,8 @@ public:
template<typename S, typename... Args>
bool Fmt(const S &format_str, Args&&... args) noexcept {
#if FMT_VERSION >= 90000
return VFmt(format_str,
fmt::make_format_args(args...));
#else
return VFmt(fmt::to_string_view(format_str),
fmt::make_args_checked<Args...>(format_str,
args...));
#endif
}
/**
@@ -92,15 +82,7 @@ public:
template<typename S, typename... Args>
void FmtError(enum ack code,
const S &format_str, Args&&... args) noexcept {
#if FMT_VERSION >= 90000
return VFmtError(code, format_str,
fmt::make_format_args(args...));
#else
return VFmtError(code, fmt::to_string_view(format_str),
fmt::make_args_checked<Args...>(format_str,
args...));
#endif
}
};
#endif