Don't use default ctor for ChipDeviceEvent (#36768)
* Don't use default ctor for ChipDeviceEvent
* Restyled by clang-format
---------
Co-authored-by: Restyled.io <commits@restyled.io>
diff --git a/src/lib/dnssd/Discovery_ImplPlatform.cpp b/src/lib/dnssd/Discovery_ImplPlatform.cpp
index 6f98ac7..e83a889 100644
--- a/src/lib/dnssd/Discovery_ImplPlatform.cpp
+++ b/src/lib/dnssd/Discovery_ImplPlatform.cpp
@@ -452,8 +452,7 @@
publisher->mState = State::kInitialized;
// Post an event that will start advertising
- DeviceLayer::ChipDeviceEvent event;
- event.Type = DeviceLayer::DeviceEventType::kDnssdInitialized;
+ DeviceLayer::ChipDeviceEvent event{ .Type = DeviceLayer::DeviceEventType::kDnssdInitialized };
CHIP_ERROR error = DeviceLayer::PlatformMgr().PostEvent(&event);
if (error != CHIP_NO_ERROR)
@@ -477,9 +476,8 @@
// Restore dnssd state before restart, also needs to call ChipDnssdShutdown()
publisher->Shutdown();
- DeviceLayer::ChipDeviceEvent event;
- event.Type = DeviceLayer::DeviceEventType::kDnssdRestartNeeded;
- error = DeviceLayer::PlatformMgr().PostEvent(&event);
+ DeviceLayer::ChipDeviceEvent event{ .Type = DeviceLayer::DeviceEventType::kDnssdRestartNeeded };
+ error = DeviceLayer::PlatformMgr().PostEvent(&event);
if (error != CHIP_NO_ERROR)
{
diff --git a/src/protocols/secure_channel/PairingSession.cpp b/src/protocols/secure_channel/PairingSession.cpp
index 6176d09..49f8071 100644
--- a/src/protocols/secure_channel/PairingSession.cpp
+++ b/src/protocols/secure_channel/PairingSession.cpp
@@ -81,8 +81,7 @@
if (err == CHIP_NO_ERROR)
{
VerifyOrDie(mSecureSessionHolder);
- DeviceLayer::ChipDeviceEvent event;
- event.Type = DeviceLayer::DeviceEventType::kSecureSessionEstablished;
+ DeviceLayer::ChipDeviceEvent event{ .Type = DeviceLayer::DeviceEventType::kSecureSessionEstablished };
event.SecureSessionEstablished.TransportType = to_underlying(address.GetTransportType());
event.SecureSessionEstablished.SecureSessionType =
to_underlying(mSecureSessionHolder->AsSecureSession()->GetSecureSessionType());