mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Merge remote-tracking branch 'MaxKellermann/eliminate_code
* MaxKellermann/eliminate_code: RE: make the RE_Matcher destructor non-virtual analyzer/protocol/smtp: remove unnecessary nullptr check analyzer/Manager: remove unnecessary clear() calls from destructor analyzer/protocol/http: remove unnecessary empty destructor iosource/pcap/Source: remove unused fields `last_hdr`, `last_data` iosource/Manager: eliminate two std::string copies
This commit is contained in:
commit
47d813badc
9 changed files with 21 additions and 19 deletions
15
CHANGES
15
CHANGES
|
@ -1,4 +1,19 @@
|
||||||
|
|
||||||
|
3.2.0-dev.44 | 2020-02-14 16:16:54 -0700
|
||||||
|
|
||||||
|
* RE: make the RE_Matcher destructor non-virtual (Max Kellermann)
|
||||||
|
|
||||||
|
* analyzer/protocol/smtp: remove unnecessary nullptr check (Max Kellermann)
|
||||||
|
|
||||||
|
* analyzer/Manager: remove unnecessary clear() calls from destructor (Max Kellermann)
|
||||||
|
|
||||||
|
* analyzer/protocol/http: remove unnecessary empty destructor (Max Kellermann)
|
||||||
|
|
||||||
|
* iosource/pcap/Source: remove unused fields `last_hdr`, `last_data` (Max Kellermann)
|
||||||
|
|
||||||
|
* iosource/Manager: eliminate two std::string copies (Max Kellermann)
|
||||||
|
|
||||||
|
|
||||||
3.2.0-dev.37 | 2020-02-14 11:09:50 -0800
|
3.2.0-dev.37 | 2020-02-14 11:09:50 -0800
|
||||||
|
|
||||||
* Fix various format specifiers (Jon Siwek, Corelight)
|
* Fix various format specifiers (Jon Siwek, Corelight)
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
3.2.0-dev.37
|
3.2.0-dev.44
|
||||||
|
|
4
src/RE.h
4
src/RE.h
|
@ -174,12 +174,12 @@ protected:
|
||||||
int current_pos;
|
int current_pos;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RE_Matcher {
|
class RE_Matcher final {
|
||||||
public:
|
public:
|
||||||
RE_Matcher();
|
RE_Matcher();
|
||||||
explicit RE_Matcher(const char* pat);
|
explicit RE_Matcher(const char* pat);
|
||||||
RE_Matcher(const char* exact_pat, const char* anywhere_pat);
|
RE_Matcher(const char* exact_pat, const char* anywhere_pat);
|
||||||
virtual ~RE_Matcher();
|
~RE_Matcher();
|
||||||
|
|
||||||
void AddPat(const char* pat);
|
void AddPat(const char* pat);
|
||||||
|
|
||||||
|
|
|
@ -70,9 +70,6 @@ Manager::~Manager()
|
||||||
for ( analyzer_map_by_port::const_iterator i = analyzers_by_port_udp.begin(); i != analyzers_by_port_udp.end(); i++ )
|
for ( analyzer_map_by_port::const_iterator i = analyzers_by_port_udp.begin(); i != analyzers_by_port_udp.end(); i++ )
|
||||||
delete i->second;
|
delete i->second;
|
||||||
|
|
||||||
analyzers_by_port_udp.clear();
|
|
||||||
analyzers_by_port_tcp.clear();
|
|
||||||
|
|
||||||
// Clean up expected-connection table.
|
// Clean up expected-connection table.
|
||||||
while ( conns_by_timeout.size() )
|
while ( conns_by_timeout.size() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -176,7 +176,6 @@ void HTTP_Entity::Deliver(int len, const char* data, int trailing_CRLF)
|
||||||
class HTTP_Entity::UncompressedOutput : public analyzer::OutputHandler {
|
class HTTP_Entity::UncompressedOutput : public analyzer::OutputHandler {
|
||||||
public:
|
public:
|
||||||
UncompressedOutput(HTTP_Entity* e) { entity = e; }
|
UncompressedOutput(HTTP_Entity* e) { entity = e; }
|
||||||
virtual ~UncompressedOutput() { }
|
|
||||||
virtual void DeliverStream(int len, const u_char* data, bool orig)
|
virtual void DeliverStream(int len, const u_char* data, bool orig)
|
||||||
{
|
{
|
||||||
entity->DeliverBodyClear(len, (char*) data, false);
|
entity->DeliverBodyClear(len, (char*) data, false);
|
||||||
|
|
|
@ -180,7 +180,6 @@ void SMTP_Analyzer::ProcessLine(int length, const char* line, bool orig)
|
||||||
{
|
{
|
||||||
// Don't know whether it is a command line or
|
// Don't know whether it is a command line or
|
||||||
// a data line.
|
// a data line.
|
||||||
if ( line_after_gap )
|
|
||||||
delete line_after_gap;
|
delete line_after_gap;
|
||||||
|
|
||||||
line_after_gap =
|
line_after_gap =
|
||||||
|
|
|
@ -325,8 +325,8 @@ static std::pair<std::string, std::string> split_prefix(std::string path)
|
||||||
PktSrc* Manager::OpenPktSrc(const std::string& path, bool is_live)
|
PktSrc* Manager::OpenPktSrc(const std::string& path, bool is_live)
|
||||||
{
|
{
|
||||||
std::pair<std::string, std::string> t = split_prefix(path);
|
std::pair<std::string, std::string> t = split_prefix(path);
|
||||||
std::string prefix = t.first;
|
const auto& prefix = t.first;
|
||||||
std::string npath = t.second;
|
const auto& npath = t.second;
|
||||||
|
|
||||||
// Find the component providing packet sources of the requested prefix.
|
// Find the component providing packet sources of the requested prefix.
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,6 @@ PcapSource::PcapSource(const std::string& path, bool is_live)
|
||||||
props.is_live = is_live;
|
props.is_live = is_live;
|
||||||
pd = nullptr;
|
pd = nullptr;
|
||||||
memset(¤t_hdr, 0, sizeof(current_hdr));
|
memset(¤t_hdr, 0, sizeof(current_hdr));
|
||||||
memset(&last_hdr, 0, sizeof(last_hdr));
|
|
||||||
last_data = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PcapSource::Open()
|
void PcapSource::Open()
|
||||||
|
@ -46,7 +44,6 @@ void PcapSource::Close()
|
||||||
|
|
||||||
pcap_close(pd);
|
pcap_close(pd);
|
||||||
pd = nullptr;
|
pd = nullptr;
|
||||||
last_data = nullptr;
|
|
||||||
|
|
||||||
Closed();
|
Closed();
|
||||||
|
|
||||||
|
@ -213,7 +210,6 @@ bool PcapSource::ExtractNextPacket(Packet* pkt)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
last_data = data;
|
|
||||||
pkt->Init(props.link_type, ¤t_hdr.ts, current_hdr.caplen, current_hdr.len, data);
|
pkt->Init(props.link_type, ¤t_hdr.ts, current_hdr.caplen, current_hdr.len, data);
|
||||||
|
|
||||||
if ( current_hdr.len == 0 || current_hdr.caplen == 0 )
|
if ( current_hdr.len == 0 || current_hdr.caplen == 0 )
|
||||||
|
@ -222,8 +218,6 @@ bool PcapSource::ExtractNextPacket(Packet* pkt)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
last_hdr = current_hdr;
|
|
||||||
last_data = data;
|
|
||||||
++stats.received;
|
++stats.received;
|
||||||
stats.bytes_received += current_hdr.len;
|
stats.bytes_received += current_hdr.len;
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,6 @@ private:
|
||||||
pcap_t *pd;
|
pcap_t *pd;
|
||||||
|
|
||||||
struct pcap_pkthdr current_hdr;
|
struct pcap_pkthdr current_hdr;
|
||||||
struct pcap_pkthdr last_hdr;
|
|
||||||
const u_char* last_data;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue