minor cleanup, std namespacing, dropping headers
Added std namespace to places where there is a cpp version, and dropped
unused c headers where found.
Change-Id: Ife538ad73042b020ee2987b70e1f021b9926b2bf
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp
index 3fd7835..893cd4c 100644
--- a/ethernet_interface.cpp
+++ b/ethernet_interface.cpp
@@ -214,7 +214,7 @@
return macAddress;
}
- strcpy(ifr.ifr_name, interfaceName.c_str());
+ std::strcpy(ifr.ifr_name, interfaceName.c_str());
if (ioctl(sock, SIOCGIFHWADDR, &ifr) != 0)
{
log<level::ERR>("ioctl failed for SIOCGIFHWADDR:",
@@ -222,10 +222,10 @@
return macAddress;
}
- snprintf(macAddress, mac_address::size, mac_address::format,
- ifr.ifr_hwaddr.sa_data[0], ifr.ifr_hwaddr.sa_data[1],
- ifr.ifr_hwaddr.sa_data[2], ifr.ifr_hwaddr.sa_data[3],
- ifr.ifr_hwaddr.sa_data[4], ifr.ifr_hwaddr.sa_data[5]);
+ std::snprintf(macAddress, mac_address::size, mac_address::format,
+ ifr.ifr_hwaddr.sa_data[0], ifr.ifr_hwaddr.sa_data[1],
+ ifr.ifr_hwaddr.sa_data[2], ifr.ifr_hwaddr.sa_data[3],
+ ifr.ifr_hwaddr.sa_data[4], ifr.ifr_hwaddr.sa_data[5]);
return macAddress;
}
diff --git a/routing_table.cpp b/routing_table.cpp
index 6a17037..ff5e3f4 100644
--- a/routing_table.cpp
+++ b/routing_table.cpp
@@ -6,9 +6,6 @@
#include <linux/rtnetlink.h>
#include <net/if.h>
#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/types.h>
diff --git a/rtnetlink_server.cpp b/rtnetlink_server.cpp
index 2e2436b..ed5f8c9 100644
--- a/rtnetlink_server.cpp
+++ b/rtnetlink_server.cpp
@@ -107,7 +107,7 @@
goto finish;
}
- memset(&addr, 0, sizeof(addr));
+ std::memset(&addr, 0, sizeof(addr));
addr.nl_family = AF_NETLINK;
addr.nl_groups = RTMGRP_IPV4_IFADDR | RTMGRP_IPV6_IFADDR;