mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 14:08:20 +00:00
Merge remote-tracking branch 'origin/topic/timw/avoid-extra-reallocs'
* origin/topic/timw/avoid-extra-reallocs: Avoid calling safe_realloc unnecessarily from ODesc::Grow()
This commit is contained in:
commit
0728676fd6
3 changed files with 11 additions and 2 deletions
4
CHANGES
4
CHANGES
|
@ -1,3 +1,7 @@
|
||||||
|
5.1.0-dev.202 | 2022-07-08 09:55:35 -0700
|
||||||
|
|
||||||
|
* Avoid calling safe_realloc unnecessarily from ODesc::Grow() (Tim Wojtulewicz, Corelight)
|
||||||
|
|
||||||
5.1.0-dev.200 | 2022-07-08 09:29:04 +0200
|
5.1.0-dev.200 | 2022-07-08 09:29:04 +0200
|
||||||
|
|
||||||
* GH-913: zeek-setup: Validate plugin debug streams during startup.
|
* GH-913: zeek-setup: Validate plugin debug streams during startup.
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
5.1.0-dev.200
|
5.1.0-dev.202
|
||||||
|
|
|
@ -373,10 +373,15 @@ void ODesc::AddBytesRaw(const void* bytes, unsigned int n)
|
||||||
|
|
||||||
void ODesc::Grow(unsigned int n)
|
void ODesc::Grow(unsigned int n)
|
||||||
{
|
{
|
||||||
|
bool size_changed = false;
|
||||||
while ( offset + n + SLOP >= size )
|
while ( offset + n + SLOP >= size )
|
||||||
|
{
|
||||||
size *= 2;
|
size *= 2;
|
||||||
|
size_changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
base = util::safe_realloc(base, size);
|
if ( size_changed )
|
||||||
|
base = util::safe_realloc(base, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ODesc::Clear()
|
void ODesc::Clear()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue