mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge branch 'misc_cleanup' of https://github.com/MaxKellermann/zeek
- Minor code formatting change in merge * 'misc_cleanup' of https://github.com/MaxKellermann/zeek: Desc: move realloc() call out of the loop SerializationFormat: move realloc() call out of the loop PacketDumper: remove unused types
This commit is contained in:
commit
e2e90ac477
3 changed files with 4 additions and 24 deletions
|
@ -376,11 +376,10 @@ void ODesc::AddBytesRaw(const void* bytes, unsigned int n)
|
|||
void ODesc::Grow(unsigned int n)
|
||||
{
|
||||
while ( offset + n + SLOP >= size )
|
||||
{
|
||||
size *= 2;
|
||||
|
||||
base = safe_realloc(base, size);
|
||||
}
|
||||
}
|
||||
|
||||
void ODesc::Clear()
|
||||
{
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <queue>
|
||||
#include <set>
|
||||
|
||||
#include <pcap.h>
|
||||
|
||||
class PacketDumper {
|
||||
|
@ -20,18 +17,3 @@ protected:
|
|||
|
||||
void SortTimeStamp(struct timeval* timestamp);
|
||||
};
|
||||
|
||||
struct IP_ID {
|
||||
uint32_t ip, id;
|
||||
};
|
||||
|
||||
struct ltipid {
|
||||
bool operator()(IP_ID id1, IP_ID id2) const
|
||||
{
|
||||
return id1.ip != id2.ip ? (id1.ip < id2.ip) :
|
||||
(id1.id < id2.id);
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::set<IP_ID, ltipid> IP_IDSet;
|
||||
uint16_t NextIP_ID(const uint32_t src_addr, const uint16_t id);
|
||||
|
|
|
@ -79,10 +79,9 @@ bool SerializationFormat::WriteData(const void* b, size_t count)
|
|||
{
|
||||
// Increase buffer if necessary.
|
||||
while ( output_pos + count > output_size )
|
||||
{
|
||||
output_size *= GROWTH_FACTOR;
|
||||
|
||||
output = (char*)safe_realloc(output, output_size);
|
||||
}
|
||||
|
||||
memcpy(output + output_pos, b, count);
|
||||
output_pos += count;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue