From 62e8199aa4236df91eda53360adf73311ad90515 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 8 Feb 2024 15:35:18 -0500 Subject: [PATCH] flt.utils.muxer: remove msgTypeStr Make {fmt} format the message type directly. Change-Id: Id887079214992a346d13fcafbd048aa8af9d4457 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/11768 Tested-by: jenkins Reviewed-by: Philippe Proulx --- src/plugins/utils/muxer/msg-iter.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/plugins/utils/muxer/msg-iter.cpp b/src/plugins/utils/muxer/msg-iter.cpp index 526be007..3a3addc7 100644 --- a/src/plugins/utils/muxer/msg-iter.cpp +++ b/src/plugins/utils/muxer/msg-iter.cpp @@ -12,6 +12,7 @@ #include "common/common.h" #include "cpp-common/bt2c/call.hpp" +#include "cpp-common/bt2c/fmt.hpp" #include "cpp-common/bt2s/make-unique.hpp" #include "cpp-common/vendor/fmt/format.h" @@ -239,11 +240,6 @@ void MsgIter::_seekBeginning() namespace { -const char *msgTypeStr(const bt2::ConstMessage msg) noexcept -{ - return bt_common_message_type_string(static_cast(msg.type())); -} - std::string optLogStr(const char * const str) noexcept { return str ? fmt::format("\"{}\"", str) : "(none)"; @@ -400,7 +396,7 @@ void MsgIter::_validateMsgClkCls(const bt2::ConstMessage msg) return; } - BT_CPPLOGD("Validating the clock class of a message: msg-type={}", msgTypeStr(msg)); + BT_CPPLOGD("Validating the clock class of a message: msg-type={}", msg.type()); /* Get the clock class, if any, of `msg` */ const auto clkCls = bt2c::call([msg]() -> bt2::OptionalBorrowedObject { @@ -440,8 +436,8 @@ bool MsgIter::_HeapComparator::operator()( BT_CPPLOGT("Comparing two messages: " "port-name-a={}, msg-a-type={}, msg-a-ts={}, " "port-name-b={}, msg-b-type={}, msg-b-ts={}", - upstreamMsgIterA->portName(), msgTypeStr(msgA), optMsgTsStr(msgTsA), - upstreamMsgIterB->portName(), msgTypeStr(msgB), optMsgTsStr(msgTsB)); + upstreamMsgIterA->portName(), msgA.type(), optMsgTsStr(msgTsA), + upstreamMsgIterB->portName(), msgB.type(), optMsgTsStr(msgTsB)); } /* -- 2.34.1