From 1132a1c9a7fdb3d6d64d789ba0df749ddd2950b3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 6 Mar 2023 19:55:59 +0100 Subject: [PATCH] protocol/ArgParser: use libfmt --- src/protocol/ArgParser.cxx | 6 ++---- test/meson.build | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/protocol/ArgParser.cxx b/src/protocol/ArgParser.cxx index f9466b7db..018bd8ac8 100644 --- a/src/protocol/ArgParser.cxx +++ b/src/protocol/ArgParser.cxx @@ -5,17 +5,15 @@ #include "RangeArg.hxx" #include "Ack.hxx" #include "Chrono.hxx" +#include "lib/fmt/ToBuffer.hxx" #include "util/NumberParser.hxx" -#include #include static inline ProtocolError MakeArgError(const char *msg, const char *value) noexcept { - char buffer[256]; - snprintf(buffer, sizeof(buffer), "%s: %s", msg, value); - return {ACK_ERROR_ARG, buffer}; + return {ACK_ERROR_ARG, FmtBuffer<256>("{}: {}", msg, value)}; } uint32_t diff --git a/test/meson.build b/test/meson.build index 20048deb7..6942e2ce7 100644 --- a/test/meson.build +++ b/test/meson.build @@ -66,6 +66,7 @@ test( include_directories: inc, dependencies: [ gtest_dep, + fmt_dep, ], ), protocol: 'gtest',