flt.utils.muxer: subjective re-format
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 1 May 2024 20:51:43 +0000 (20:51 +0000)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 9 Oct 2024 02:56:57 +0000 (22:56 -0400)
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 <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12505
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/plugins/utils/muxer/msg-iter.cpp

index c0ca5ee182ed3cc1b17d0b11086be4b973bf46ac..538d7e4bc369b249f8f2de9ae4db3fae52822132 100644 (file)
@@ -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());
         }
-        }
     }
 }
 
This page took 0.026666 seconds and 4 git commands to generate.