Skip to content

Commit

Permalink
Remove unused includes (seladb#1604)
Browse files Browse the repository at this point in the history
* Remove unused includes

* Fix

* Add back `cstring` where needed

* Remove unused includes from examples and tutorials

* Add `cstdlib`

* Remove unused includes for DPDK

* Remove unused includes for PF_RING

* Remove one more unused include for PF_RING
  • Loading branch information
seladb authored and fxlb committed Oct 22, 2024
1 parent 2c8232d commit 1fea957
Show file tree
Hide file tree
Showing 91 changed files with 20 additions and 160 deletions.
3 changes: 1 addition & 2 deletions Common++/src/GeneralUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
#include "Logger.h"
#include <sstream>
#include <iomanip>
#include <string.h>
#include <stdlib.h>
#include <cstring>

namespace pcpp
{
Expand Down
3 changes: 0 additions & 3 deletions Common++/src/IpAddress.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#define LOG_MODULE CommonLogModuleIpUtils

#include <algorithm>
#include <cmath>
#include <errno.h>
#include <sstream>
#include <stdexcept>
#include <stdint.h>
#include <bitset>
#include "Logger.h"
#include "IpUtils.h"
Expand Down
3 changes: 1 addition & 2 deletions Common++/src/IpUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

#include "IpUtils.h"
#include "Logger.h"
#include <string.h>
#include <stdio.h>
#include <cstring>
#include <stdexcept>
#ifndef NS_INADDRSZ
# define NS_INADDRSZ 4
Expand Down
2 changes: 0 additions & 2 deletions Common++/src/MacAddress.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <stdio.h>

#include "MacAddress.h"

namespace pcpp
Expand Down
5 changes: 2 additions & 3 deletions Common++/src/SystemUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
#include <array>
#include <iostream>
#include <mutex>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <cstring>
#include <csignal>
#include <sys/stat.h>
#if defined(__APPLE__)
# include <mach/clock.h>
Expand Down
1 change: 0 additions & 1 deletion Common++/src/TablePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <iomanip>
#include <sstream>
#include <iostream>
#include <iterator>
#include <numeric>
#include <utility>
#include "TablePrinter.h"
Expand Down
4 changes: 0 additions & 4 deletions Examples/ArpSpoofing/main.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <memory>
#include <MacAddress.h>
#include <IpAddress.h>
#include <PcapPlusPlusVersion.h>
Expand All @@ -11,7 +8,6 @@
#include <PcapLiveDevice.h>
#include <EthLayer.h>
#include <ArpLayer.h>
#include <Logger.h>
#include <getopt.h>

#define EXIT_WITH_ERROR(reason) \
Expand Down
1 change: 0 additions & 1 deletion Examples/Arping/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* response. Its basic input is the target IP address and the interface name/IP to send the ARP request from
*/

#include <stdlib.h>
#include <iostream>
#include <MacAddress.h>
#include <IpAddress.h>
Expand Down
1 change: 0 additions & 1 deletion Examples/DNSResolver/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <stdlib.h>
#include <iostream>
#include "PcapPlusPlusVersion.h"
#include "PcapLiveDevice.h"
Expand Down
1 change: 0 additions & 1 deletion Examples/DpdkBridge/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <iomanip>
#include <iostream>
#include <sstream>
#include <stdlib.h>

/**
* Macros for exiting the application with error
Expand Down
6 changes: 0 additions & 6 deletions Examples/DpdkBridge/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,12 @@
#include "AppWorkerThread.h"

#include "DpdkDeviceList.h"
#include "IPv4Layer.h"
#include "TcpLayer.h"
#include "UdpLayer.h"
#include "SystemUtils.h"
#include "PcapPlusPlusVersion.h"
#include "TablePrinter.h"

#include <vector>
#include <iostream>
#include <iomanip>
#include <stdlib.h>
#include <signal.h>
#include <getopt.h>
#include <string>
#include <sstream>
Expand Down
1 change: 0 additions & 1 deletion Examples/DpdkExample-FilterTraffic/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <iomanip>
#include <iostream>
#include <sstream>
#include <stdlib.h>

/**
* Macros for exiting the application with error
Expand Down
1 change: 0 additions & 1 deletion Examples/DpdkExample-FilterTraffic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

#include <vector>
#include <iostream>
#include <stdlib.h>
#include <getopt.h>
#include <string>
#include <sstream>
Expand Down
2 changes: 0 additions & 2 deletions Examples/HttpAnalyzer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
* For more details about modes of operation and parameters run HttpAnalyzer -h
*/

#include <stdlib.h>
#include <string.h>
#include <iomanip>
#include <algorithm>
#include "PcapLiveDeviceList.h"
Expand Down
3 changes: 1 addition & 2 deletions Examples/IPDefragUtil/main.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include <iostream>
#include <unordered_map>
#include <sstream>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include "PcapPlusPlusVersion.h"
#include "IPv4Layer.h"
#include "IPv6Layer.h"
Expand Down
5 changes: 2 additions & 3 deletions Examples/IPFragUtil/main.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#include <iostream>
#include <unordered_map>
#include <sstream>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <cstring>
#include <cmath>
#include "PcapPlusPlusVersion.h"
#include "Packet.h"
#include "IPv4Layer.h"
Expand Down
1 change: 0 additions & 1 deletion Examples/IcmpFileTransfer/Common.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "Common.h"
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <getopt.h>
Expand Down
1 change: 0 additions & 1 deletion Examples/IcmpFileTransfer/IcmpFileTransfer-catcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* For more information please refer to README.md
*/

#include <stdlib.h>
#include <iostream>
#include <fstream>
#include "EthLayer.h"
Expand Down
1 change: 0 additions & 1 deletion Examples/IcmpFileTransfer/IcmpFileTransfer-pitcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* For more information please refer to README.md
*/

#include <stdlib.h>
#include <stdexcept>
#include <iostream>
#include <fstream>
Expand Down
1 change: 0 additions & 1 deletion Examples/PcapPrinter/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* For more details about modes of operation and parameters run PcapPrinter -h
*/

#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <sstream>
Expand Down
1 change: 0 additions & 1 deletion Examples/PcapSearch/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
* For more details about modes of operation and parameters please run PcapSearch -h
*/

#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <sstream>
Expand Down
4 changes: 0 additions & 4 deletions Examples/PcapSplitter/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,8 @@
*
*/

#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <iomanip>
#include <unordered_map>
#include <RawPacket.h>
#include <Packet.h>
Expand Down
8 changes: 0 additions & 8 deletions Examples/PfRingExample-FilterTraffic/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@

#include <Packet.h>
#include <PfRingDeviceList.h>

#include <SystemUtils.h>

#include <string>
#include <vector>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <stdlib.h>

/**
* Macros for exiting the application with error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include "SystemUtils.h"
#include "Packet.h"
#include "IPv4Layer.h"
#include "TcpLayer.h"
Expand Down
4 changes: 0 additions & 4 deletions Examples/PfRingExample-FilterTraffic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,11 @@

#include "Common.h"
#include "PacketMatchingEngine.h"
#include <PfRingDeviceList.h>
#include <PcapFileDevice.h>
#include <PacketUtils.h>
#include <SystemUtils.h>
#include <PcapPlusPlusVersion.h>
#include <TablePrinter.h>
#include <Logger.h>
#include <stdlib.h>
#include <vector>
#include <getopt.h>
#include <unordered_map>
#include <sstream>
Expand Down
2 changes: 0 additions & 2 deletions Examples/SSLAnalyzer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
* For more details about modes of operation and parameters run SSLAnalyzer -h
*/

#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
Expand Down
1 change: 0 additions & 1 deletion Examples/TcpReassembly/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
* For more details about modes of operation and parameters run TcpReassembly -h
*/

#include <stdlib.h>
#include <unordered_map>
#include <iostream>
#include <fstream>
Expand Down
1 change: 0 additions & 1 deletion Examples/Tutorials/Tutorial-LiveTraffic/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <iostream>
#include <algorithm>
#include "stdlib.h"
#include "PcapLiveDeviceList.h"
#include "SystemUtils.h"
/**
Expand Down
1 change: 0 additions & 1 deletion Examples/Tutorials/Tutorial-PacketCraftAndEdit/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <iostream>
#include <memory>
#include "stdlib.h"
#include "SystemUtils.h"
#include "Packet.h"
#include "EthLayer.h"
Expand Down
1 change: 0 additions & 1 deletion Examples/Tutorials/Tutorial-PacketParsing/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <iostream>
#include <memory>
#include "stdlib.h"
#include "SystemUtils.h"
#include "Packet.h"
#include "EthLayer.h"
Expand Down
1 change: 0 additions & 1 deletion Examples/Tutorials/Tutorial-PcapFiles/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <memory>
#include <iostream>
#include "stdlib.h"
#include "PcapFileDevice.h"

/**
Expand Down
1 change: 0 additions & 1 deletion Packet++/src/ArpLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "ArpLayer.h"
#include "EthLayer.h"
#include <string.h>
#include "EndianPortable.h"

namespace pcpp
Expand Down
3 changes: 1 addition & 2 deletions Packet++/src/Asn1Codec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
#include "Asn1Codec.h"
#include "GeneralUtils.h"
#include "EndianPortable.h"
#include "GeneralUtils.h"
#include <unordered_map>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <cstring>
#include <cmath>
#include <limits>
#include <cstring>

#if defined(_WIN32)
# undef max
Expand Down
1 change: 0 additions & 1 deletion Packet++/src/BgpLayer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#define LOG_MODULE PacketLogModuleBgpLayer

#include <string.h>
#include "Logger.h"
#include "BgpLayer.h"
#include "EndianPortable.h"
Expand Down
4 changes: 0 additions & 4 deletions Packet++/src/CotpLayer.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#include "../header/CotpLayer.h"
#include "EndianPortable.h"
#include "S7CommLayer.h"
#include <PayloadLayer.h>
#include <cstring>
#include <iostream>
#include <sstream>

namespace pcpp
{
Expand Down
4 changes: 0 additions & 4 deletions Packet++/src/DnsLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

#include "DnsLayer.h"
#include "Logger.h"
#include "IpAddress.h"
#include <sstream>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include "EndianPortable.h"

namespace pcpp
Expand Down
1 change: 0 additions & 1 deletion Packet++/src/DnsResource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "DnsResource.h"
#include "Logger.h"
#include <sstream>
#include <string.h>
#include "EndianPortable.h"

namespace pcpp
Expand Down
1 change: 0 additions & 1 deletion Packet++/src/DnsResourceData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "GeneralUtils.h"
#include <sstream>
#include <utility>
#include <string.h>
#include "EndianPortable.h"

namespace pcpp
Expand Down
1 change: 0 additions & 1 deletion Packet++/src/EthLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "MplsLayer.h"
#include "WakeOnLanLayer.h"
#include "EndianPortable.h"
#include <string.h>

namespace pcpp
{
Expand Down
4 changes: 1 addition & 3 deletions Packet++/src/HttpLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
#include "Logger.h"
#include "GeneralUtils.h"
#include "HttpLayer.h"
#include <string.h>
#include <cstring>
#include <algorithm>
#include <stdlib.h>
#include <exception>
#include <utility>
#include <unordered_map>

namespace pcpp
Expand Down
1 change: 0 additions & 1 deletion Packet++/src/IPReassembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "IPv6Layer.h"
#include "PacketUtils.h"
#include "Logger.h"
#include <string.h>
#include "EndianPortable.h"

namespace pcpp
Expand Down
Loading

0 comments on commit 1fea957

Please sign in to comment.