Use more C++17 features
Mainly structured bindings, inline variables, and class template
argument deduction, plus many more smaller things.
Change-Id: I810d17e0adb470426e4e30c898e03b3140ad052f
diff --git a/daemon/face/ethernet-channel.cpp b/daemon/face/ethernet-channel.cpp
index fae9af2..2509140 100644
--- a/daemon/face/ethernet-channel.cpp
+++ b/daemon/face/ethernet-channel.cpp
@@ -120,19 +120,15 @@
return;
}
- span<const uint8_t> pkt;
- std::string err;
- std::tie(pkt, err) = m_pcap.readNextPacket();
-
+ auto [pkt, readErr] = m_pcap.readNextPacket();
if (pkt.empty()) {
- NFD_LOG_CHAN_WARN("Read error: " << err);
+ NFD_LOG_CHAN_WARN("Read error: " << readErr);
}
else {
- const ether_header* eh;
- std::tie(eh, err) = ethernet::checkFrameHeader(pkt, m_localEndpoint->getEthernetAddress(),
- m_localEndpoint->getEthernetAddress());
+ auto [eh, frameErr] = ethernet::checkFrameHeader(pkt, m_localEndpoint->getEthernetAddress(),
+ m_localEndpoint->getEthernetAddress());
if (eh == nullptr) {
- NFD_LOG_CHAN_DEBUG(err);
+ NFD_LOG_CHAN_DEBUG(frameErr);
}
else {
ethernet::Address sender(eh->ether_shost);