From: Simon Marchi Date: Wed, 1 May 2024 20:51:43 +0000 (+0000) Subject: flt.utils.muxer: subjective re-format X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=ce2f1fbe59b7e1eed2dd404d929d5681a66899ec;p=babeltrace.git flt.utils.muxer: subjective re-format Wrap arguments to `BT_CPPLOGE_APPEND_CAUSE_AND_THROW` so that we can have slightly longer strings (still within 100 columns). Remove unnecessary local variables. Change-Id: If7412e6913d06d12142f01e09742d4d6a5dc5d0e Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/12505 Tested-by: jenkins Reviewed-by: Philippe Proulx --- diff --git a/src/plugins/utils/muxer/msg-iter.cpp b/src/plugins/utils/muxer/msg-iter.cpp index c0ca5ee1..538d7e4b 100644 --- a/src/plugins/utils/muxer/msg-iter.cpp +++ b/src/plugins/utils/muxer/msg-iter.cpp @@ -254,33 +254,27 @@ void MsgIter::_validateMsgClkCls(const bt2::ConstMessage msg) switch (error.type()) { case Type::ExpectingNoClockClassGotOne: - BT_CPPLOGE_APPEND_CAUSE_AND_THROW(bt2::Error, - "Expecting no clock class, but got one: " - "clock-class-addr={}, clock-class-name={}", - fmt::ptr(actualClockCls->libObjPtr()), - actualClockCls->name()); + BT_CPPLOGE_APPEND_CAUSE_AND_THROW( + bt2::Error, + "Expecting no clock class, but got one: clock-class-addr={}, clock-class-name={}", + fmt::ptr(actualClockCls->libObjPtr()), actualClockCls->name()); case Type::ExpectingOriginUnixGotNone: case Type::ExpectingOriginUuidGotNone: case Type::ExpectingOriginNoUuidGotNone: - { - const auto streamCls = *error.streamCls(); - - BT_CPPLOGE_APPEND_CAUSE_AND_THROW(bt2::Error, - "Expecting a clock class, but got none: " - "stream-class-addr={}, stream-class-name=\"{}\", " - "stream-class-id={}", - fmt::ptr(streamCls.libObjPtr()), streamCls.name(), - streamCls.id()); - } + BT_CPPLOGE_APPEND_CAUSE_AND_THROW( + bt2::Error, + "Expecting a clock class, but got none: stream-class-addr={}, " + "stream-class-name=\"{}\", stream-class-id={}", + fmt::ptr(error.streamCls()->libObjPtr()), error.streamCls()->name(), + error.streamCls()->id()); case Type::ExpectingOriginUnixGotOther: - BT_CPPLOGE_APPEND_CAUSE_AND_THROW(bt2::Error, - "Expecting a clock class having a Unix epoch origin, " - "but got one not having a Unix epoch origin: " - "clock-class-addr={}, clock-class-name={}", - fmt::ptr(actualClockCls->libObjPtr()), - actualClockCls->name()); + BT_CPPLOGE_APPEND_CAUSE_AND_THROW( + bt2::Error, + "Expecting a clock class having a Unix epoch origin, but got one not having a Unix " + "epoch origin: clock-class-addr={}, clock-class-name={}", + fmt::ptr(actualClockCls->libObjPtr()), actualClockCls->name()); case Type::ExpectingOriginUuidGotUnix: BT_CPPLOGE_APPEND_CAUSE_AND_THROW( @@ -298,28 +292,22 @@ void MsgIter::_validateMsgClkCls(const bt2::ConstMessage msg) fmt::ptr(actualClockCls->libObjPtr()), actualClockCls->name()); case Type::ExpectingOriginUuidGotOtherUuid: - BT_CPPLOGE_APPEND_CAUSE_AND_THROW(bt2::Error, - "Expecting a clock class with a specific UUID, " - "but got one with a different UUID: " - "clock-class-addr={}, clock-class-name={}, " - "expected-uuid=\"{}\", uuid=\"{}\"", - fmt::ptr(actualClockCls->libObjPtr()), - actualClockCls->name(), *error.expectedUuid(), - *actualClockCls->uuid()); + BT_CPPLOGE_APPEND_CAUSE_AND_THROW( + bt2::Error, + "Expecting a clock class with a specific UUID, but got one with a different UUID: " + "clock-class-addr={}, clock-class-name={}, expected-uuid=\"{}\", uuid=\"{}\"", + fmt::ptr(actualClockCls->libObjPtr()), actualClockCls->name(), + *error.expectedUuid(), *actualClockCls->uuid()); case Type::ExpectingOriginNoUuidGotOther: - { - const auto expectedClockCls = error.expectedClockCls(); - BT_CPPLOGE_APPEND_CAUSE_AND_THROW( bt2::Error, "Unexpected clock class: " "expected-clock-class-addr={}, expected-clock-class-name={}, " "actual-clock-class-addr={}, actual-clock-class-name={}", - fmt::ptr(expectedClockCls->libObjPtr()), expectedClockCls->name(), + fmt::ptr(error.expectedClockCls()->libObjPtr()), error.expectedClockCls()->name(), fmt::ptr(actualClockCls->libObjPtr()), actualClockCls->name()); } - } } }