mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
SerializationFormat: move realloc() call out of the loop
Reallocate and copy the data only once.
This commit is contained in:
parent
ef15467757
commit
61c3be8e16
1 changed files with 1 additions and 1 deletions
|
@ -81,8 +81,8 @@ bool SerializationFormat::WriteData(const void* b, size_t count)
|
||||||
while ( output_pos + count > output_size )
|
while ( output_pos + count > output_size )
|
||||||
{
|
{
|
||||||
output_size *= GROWTH_FACTOR;
|
output_size *= GROWTH_FACTOR;
|
||||||
output = (char*)safe_realloc(output, output_size);
|
|
||||||
}
|
}
|
||||||
|
output = (char*)safe_realloc(output, output_size);
|
||||||
|
|
||||||
memcpy(output + output_pos, b, count);
|
memcpy(output + output_pos, b, count);
|
||||||
output_pos += count;
|
output_pos += count;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue