click: Fix clang-tidy warnings

This commit is contained in:
Eduardo Almeida
2022-10-29 14:37:46 +01:00
parent f2a871566e
commit 175be782d1
2 changed files with 14 additions and 11 deletions

View File

@@ -61,7 +61,7 @@ Ipv4ClickRouting::GetTypeId()
Ipv4ClickRouting::Ipv4ClickRouting()
: m_nonDefaultName(false),
m_ipv4(0)
m_ipv4(nullptr)
{
m_random = CreateObject<UniformRandomVariable>();
m_simNode = new simclick_node_t;
@@ -124,7 +124,7 @@ Ipv4ClickRouting::DoDispose()
{
simclick_click_kill(m_simNode);
}
m_ipv4 = 0;
m_ipv4 = nullptr;
delete m_simNode;
Ipv4RoutingProtocol::DoDispose();
}
@@ -441,8 +441,11 @@ Ipv4ClickRouting::Receive(Ptr<Packet> p, Mac48Address receiverAddr, Mac48Address
std::string
Ipv4ClickRouting::ReadHandler(std::string elementName, std::string handlerName)
{
char* handle =
simclick_click_read_handler(m_simNode, elementName.c_str(), handlerName.c_str(), 0, 0);
char* handle = simclick_click_read_handler(m_simNode,
elementName.c_str(),
handlerName.c_str(),
nullptr,
nullptr);
std::string ret(handle);
// This is required because Click does not free
@@ -497,7 +500,7 @@ Ipv4ClickRouting::RouteOutput(Ptr<Packet> p,
std::string s = ReadHandler(m_clickRoutingTableElement, addr.str());
NS_LOG_DEBUG("string from click routing table: " << s);
size_t pos = s.find(" ");
size_t pos = s.find(' ');
Ipv4Address destination;
int interfaceId;
if (pos == std::string::npos)

View File

@@ -82,13 +82,13 @@ Ipv4L3ClickProtocol::DoDispose()
NS_LOG_FUNCTION(this);
for (L4List_t::iterator i = m_protocols.begin(); i != m_protocols.end(); ++i)
{
i->second = 0;
i->second = nullptr;
}
m_protocols.clear();
for (Ipv4InterfaceList::iterator i = m_interfaces.begin(); i != m_interfaces.end(); ++i)
{
*i = 0;
*i = nullptr;
}
m_interfaces.clear();
m_reverseInterfacesContainer.clear();
@@ -137,7 +137,7 @@ Ipv4L3ClickProtocol::GetInterface(uint32_t index) const
{
return m_interfaces[index];
}
return 0;
return nullptr;
}
uint32_t
@@ -320,7 +320,7 @@ Ipv4L3ClickProtocol::SetupLoopback()
NS_LOG_FUNCTION_NOARGS();
Ptr<Ipv4Interface> interface = CreateObject<Ipv4Interface>();
Ptr<LoopbackNetDevice> device = 0;
Ptr<LoopbackNetDevice> device = nullptr;
// First check whether an existing LoopbackNetDevice exists on the node
for (uint32_t i = 0; i < m_node->GetNDevices(); i++)
{
@@ -889,7 +889,7 @@ Ipv4L3ClickProtocol::GetIcmp() const
}
else
{
return 0;
return nullptr;
}
}
@@ -989,7 +989,7 @@ Ipv4L3ClickProtocol::GetProtocol(int protocolNumber, int32_t interfaceIndex) con
return i->second;
}
return 0;
return nullptr;
}
} // namespace ns3